Skip to content

Revert "perf: use Uint8Array bitmaps for faster tag ID lookups"#1724

Merged
fb55 merged 1 commit intomasterfrom
revert-1679-bitmap-optimizations
Mar 27, 2026
Merged

Revert "perf: use Uint8Array bitmaps for faster tag ID lookups"#1724
fb55 merged 1 commit intomasterfrom
revert-1679-bitmap-optimizations

Conversation

@fb55
Copy link
Copy Markdown
Collaborator

@fb55 fb55 commented Mar 27, 2026

Reverts #1679

Performance seems equivalent if not slightly worse, plus increases the code size.

Copilot AI review requested due to automatic review settings March 27, 2026 11:38
@fb55 fb55 enabled auto-merge (squash) March 27, 2026 11:38
@fb55 fb55 merged commit 32764f3 into master Mar 27, 2026
10 of 12 checks passed
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 95.746% (-0.009%) from 95.755%
when pulling 6813154 on revert-1679-bitmap-optimizations
into f7c310f on master.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 Set membership 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
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

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

Copilot uses AI. Check for mistakes.
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.

3 participants