perf(renderer): hoist quadMap out of renderBlockElement hot path#23
Merged
Conversation
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>
There was a problem hiding this comment.
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.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.