GeezerVison is showing github.com — perf: use lookup table in splitIntoPotentialTokens by xiaoxiaojx · Pull Request #240 · webpack/webpack-sources
Conversation
Summary
- Replace multi-comparison chains in
splitIntoPotentialTokens with a 128-byte Uint8Array bitmask lookup table
- Phase 1 previously checked 4 conditions (
cc !== 10/59/123/125) and phase 2 checked 6 conditions (cc === 59/32/123/125/13/9) per character — now both are a single indexed read + bitwise AND
Benchmark results (ops/s, higher is better)
| Benchmark |
Before |
After |
Change |
| splitIntoPotentialTokens: fixture |
533 |
574 |
+7.7% |
| splitIntoPotentialTokens: big source |
392 |
474 |
+20.9% |
| original-source: streamChunks() |
904 |
983 |
+8.7% |
| original-source: streamChunks() (big) |
334 |
419 |
+25.4% |
| original-source: map() |
628 |
669 |
+6.5% |
| original-source: sourceAndMap() |
626 |
667 |
+6.5% |
| concat-source: streamChunks() (mixed) |
812 |
882 |
+8.6% |
| concat-source: sourceAndMap() |
586 |
623 |
+6.3% |
| realistic cold sourceAndMap() |
864 |
901 |
+4.3% |
| realistic cold map() |
863 |
899 |
+4.2% |
| realistic streamChunks(columns on) |
1,154 |
1,208 |
+4.7% |
No regressions observed. All 89,869 tests pass.
Test plan
-
yarn lint passes
-
npx jest --no-coverage — 89,869 tests pass
- Benchmark verified with
npm run benchmark
🤖 Generated with Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Replace multi-comparison chains with a Uint8Array bitmask lookup per
character. Phase 1 checked 4 conditions (cc !== 10/59/123/125) and
phase 2 checked 6 conditions (cc === 59/32/123/125/13/9) on every
character. The lookup table reduces both to a single indexed read
plus one bitwise AND.
Benchmark results (ops/s, higher is better):
splitIntoPotentialTokens fixture: 533 → 574 (+7.7%)
splitIntoPotentialTokens big: 392 → 474 (+20.9%)
original-source streamChunks(): 904 → 983 (+8.7%)
original-source streamChunks(big): 334 → 419 (+25.4%)
realistic cold sourceAndMap(): 864 → 901 (+4.3%)
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Merging this PR will improve performance by 23.21%
⚠️ Different runtime environments detected
Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.
Open the report in CodSpeed to investigate
⚡ 13 improved benchmarks
❌ 21 regressed benchmarks
✅ 177 untouched benchmarks
Performance Changes
ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.
Tip Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing perf/split-into-potential-tokens-lookup-table (04b8a57) with main (e02802e)
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
codecov
Bot
commented
Jun 23, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.59%. Comparing base (e02802e) to head (04b8a57).
Additional details and impacted files
@@ Coverage Diff @@
## main #240 +/- ##
=======================================
Coverage 97.58% 97.59%
=======================================
Files 25 25
Lines 2069 2076 +7
Branches 668 664 -4
=======================================
+ Hits 2019 2026 +7
Misses 47 47
Partials 3 3
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.
🚀 New features to boost your workflow:
- ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|