Skip to content

fix: improve performance in many places#209

Merged
alexander-akait merged 3 commits intomainfrom
claude/perf-improvements-D2ZFm
Apr 22, 2026
Merged

fix: improve performance in many places#209
alexander-akait merged 3 commits intomainfrom
claude/perf-improvements-D2ZFm

Conversation

@alexander-akait
Copy link
Copy Markdown
Member

  • readMappings: avoid Int32Array iterator protocol by indexing
    currentData[0] directly instead of destructuring
  • createMappingsSerializer: skip ";".repeat(1) for the dominant
    consecutive-line case
  • splitIntoPotentialTokens: replace chained === comparisons with
    two Uint8Array lookup tables in the hot scan loops
  • streamChunksOfSourceMap: hoist lines.length and drop a redundant
    per-iteration bounds check; in the lines-only path the bounds check
    is already guaranteed by the leading guard
  • streamChunksOfCombinedSourceMap: coerce binary-search r to int32
  • ConcatSource.streamChunks: only compute the remapped nameIndex
    when the chunk actually carries a source mapping

https://claude.ai/code/session_013RELTj96iEXrmMSPxnwjeR

- readMappings: avoid Int32Array iterator protocol by indexing
  `currentData[0]` directly instead of destructuring
- createMappingsSerializer: skip `";".repeat(1)` for the dominant
  consecutive-line case
- splitIntoPotentialTokens: replace chained `===` comparisons with
  two Uint8Array lookup tables in the hot scan loops
- streamChunksOfSourceMap: hoist `lines.length` and drop a redundant
  per-iteration bounds check; in the lines-only path the bounds check
  is already guaranteed by the leading guard
- streamChunksOfCombinedSourceMap: coerce binary-search `r` to int32
- ConcatSource.streamChunks: only compute the remapped `nameIndex`
  when the chunk actually carries a source mapping

https://claude.ai/code/session_013RELTj96iEXrmMSPxnwjeR
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 22, 2026

🦋 Changeset detected

Latest commit: b7b260c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
webpack-sources Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented Apr 22, 2026

CLA Not Signed

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

❌ Patch coverage is 93.54839% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.72%. Comparing base (ccfbc65) to head (b7b260c).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
lib/helpers/streamChunksOfSourceMap.js 90.47% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #209      +/-   ##
==========================================
- Coverage   97.77%   97.72%   -0.05%     
==========================================
  Files          25       25              
  Lines        1932     1938       +6     
  Branches      606      607       +1     
==========================================
+ Hits         1889     1894       +5     
- Misses         41       42       +1     
  Partials        2        2              
Flag Coverage Δ
integration 97.72% <93.54%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 22, 2026

Merging this PR will improve performance by 70.17%

⚠️ 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

⚡ 10 improved benchmarks
✅ 151 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
concat-source: streamChunks() with SourceMapSource child 17.6 ms 14.7 ms +19.84%
cached-source: streamChunks() (warm) 14.4 ms 11.7 ms +23.44%
helpers/readMappings: fixture (counting callback) 1,466.8 µs 916.4 µs +60.07%
helpers/readMappings: fixture (noop callback) 27.5 ms 16.1 ms +70.17%
prefix-source: streamChunks() with SourceMapSource child 16.3 ms 13.6 ms +20.31%
realistic-source-map-pipeline: streamChunks() (columns off) 7 ms 6.3 ms +10.51%
source-map-source: streamChunks() (combined inner map) 11.7 ms 9.9 ms +17.36%
source-map-source: streamChunks({finalSource:true}) 9.9 ms 7.1 ms +38.48%
source-map-source: streamChunks() 14.5 ms 11.7 ms +23.29%
source-map-source: streamChunks({columns:false}) 9.5 ms 6.6 ms +44.52%

Comparing claude/perf-improvements-D2ZFm (b7b260c) with main (ccfbc65)

Open in CodSpeed

claude and others added 2 commits April 22, 2026 18:06
CodSpeed reports a ~19% instruction-count regression on both
`helpers/splitIntoPotentialTokens` benchmarks (and ~11% on the
`original-source` streamChunks benchmarks that call it) when the
chained `===` comparisons are replaced with Uint8Array lookups.
Restore the comparison-chain form; the other perf changes from the
previous commit (readMappings, streamChunksOfSourceMap,
createMappingsSerializer, ConcatSource, streamChunksOfCombinedSourceMap)
are unaffected.

https://claude.ai/code/session_013RELTj96iEXrmMSPxnwjeR
@alexander-akait alexander-akait merged commit e130653 into main Apr 22, 2026
23 of 35 checks passed
@alexander-akait alexander-akait deleted the claude/perf-improvements-D2ZFm branch April 22, 2026 18:38
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.

2 participants