Revert "perf: use Uint8Array bitmaps for faster tag ID lookups"#1724
Merged
Revert "perf: use Uint8Array bitmaps for faster tag ID lookups"#1724
Conversation
This reverts commit f7c310f.
There was a problem hiding this comment.
Pull request overview
This PR reverts the previously introduced Uint8Array bitmap optimization for tag ID membership checks in parse5, restoring Set-based lookups to keep performance neutral (or better) while reducing code size.
Changes:
- Replace bitmap-based scope checks in the open element stack with
Setmembership checks. - Replace bitmap-based foreign-content “exit tags” lookup with a
Set. - Remove the bitmap helper module and the SVG benchmark script introduced with the optimization.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/parse5/lib/parser/open-element-stack.ts | Reverts scope checking from bitmap lookups back to Set-based scoping element checks. |
| packages/parse5/lib/common/tag-id-bitmap.ts | Removes the bitmap implementation helper entirely. |
| packages/parse5/lib/common/foreign-content.ts | Reverts foreign-content exit-tag lookup from bitmap back to a Set. |
| bench/perf/svg-benchmark.js | Removes the SVG benchmark script that was added alongside the optimization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| //Tags that causes exit from foreign content - using bit-packed bitmap for faster lookup | ||
| const EXITS_FOREIGN_CONTENT_BITMAP = createBitmap([ | ||
| //Tags that causes exit from foreign content |
There was a problem hiding this comment.
Grammar in the comment: "Tags that causes exit from foreign content" should be "Tags that cause exit from foreign content".
Suggested change
| //Tags that causes exit from foreign content | |
| // Tags that cause exit from foreign content |
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.
Reverts #1679
Performance seems equivalent if not slightly worse, plus increases the code size.