Skip to content

perf(renderer): hoist quadMap out of renderBlockElement hot path#23

Merged
sauyon merged 2 commits into
mainfrom
sauyon/quadmap-hoist
May 18, 2026
Merged

perf(renderer): hoist quadMap out of renderBlockElement hot path#23
sauyon merged 2 commits into
mainfrom
sauyon/quadmap-hoist

Conversation

@sauyon

@sauyon sauyon commented May 18, 2026

Copy link
Copy Markdown
Owner

Move the quadrant codepoint lookup table (and its QUAD_* bit constants) to module scope as a Map so it's constructed once at load time rather than on every renderBlockElement call. The switch to Map also drops the need for the lib/renderer.ts useSimpleNumberKeys lint override added in 3836409.

Move the quadrant codepoint lookup table (and its QUAD_* bit
constants) to module scope as a Map so it's constructed once
at load time rather than on every renderBlockElement call.
The switch to Map also drops the need for the lib/renderer.ts
useSimpleNumberKeys lint override added in 3836409.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the quadrant block element mapping in lib/renderer.ts by hoisting constants and the mapping logic to the top level, transitioning from a local Record to a global Map. Additionally, it removes a linter override in biome.json. However, the reviewer identified that the method being optimized, renderBlockElement, appears to be dead code that is not currently invoked. The feedback suggests either removing the unused implementation entirely or updating the call site to utilize this optimized path.

Comment thread lib/renderer.ts Outdated
renderBlockElement was the original procedural block-element renderer
introduced in b6ef353. It was superseded by lib/box-drawing.ts's
drawBoxOrBlock (wired into renderCellText in f737572) and has had no
call sites since the box-drawing module landed.

Removes the method, the QUAD_* constants, and the QUAD_MAP added in
the previous commit (which optimized a code path that wasn't executed).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sauyon
sauyon merged commit 1de41e9 into main May 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant