Skip to content

perf(@angular/build): optimize sourcemap stripping and loading with buffer fast path - #33816

Draft
clydin wants to merge 1 commit into
angular:mainfrom
clydin:perf/buffer-sourcemap-fast-path
Draft

perf(@angular/build): optimize sourcemap stripping and loading with buffer fast path#33816
clydin wants to merge 1 commit into
angular:mainfrom
clydin:perf/buffer-sourcemap-fast-path

Conversation

@clydin

@clydin clydin commented Aug 7, 2026

Copy link
Copy Markdown
Member

Optimize sourcemap detection, loading, and stripping during JavaScript transformations by inspecting incoming raw Uint8Array/Buffer data directly before decoding into strings.

Files without sourcemap comments are identified via fast Buffer.indexOf() and skip comment removal entirely. For single trailing comments, the sourcemap is parsed directly from the trailing URL slice and the raw code buffer is sliced using a zero-copy subarray view to avoid large string allocations and trailing state-machine scans. Line-start boundaries and end-of-file trailing whitespace are validated to prevent false positives with template strings, safely falling back to full string state-machine parsing when necessary.

…uffer fast path

Optimize sourcemap detection, loading, and stripping during JavaScript transformations by inspecting incoming raw Uint8Array/Buffer data directly before decoding into strings.

Files without sourcemap comments are identified via fast Buffer.indexOf() and skip comment removal entirely. For single trailing comments, the sourcemap is parsed directly from the trailing URL slice and the raw code buffer is sliced using a zero-copy subarray view to avoid large string allocations and trailing state-machine scans. Line-start boundaries and end-of-file trailing whitespace are validated to prevent false positives with template strings, safely falling back to full string state-machine parsing when necessary.
@angular-robot angular-robot Bot added area: performance Issues related to performance area: @angular/build labels Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: @angular/build area: performance Issues related to performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant