Skip to content

perf: avoid temporary Vec in ConcatSourceMapBuilder::add_sourcemap#290

Merged
Boshen merged 1 commit intomainfrom
perf/avoid-temp-vec-add-sourcemap
Mar 20, 2026
Merged

perf: avoid temporary Vec in ConcatSourceMapBuilder::add_sourcemap#290
Boshen merged 1 commit intomainfrom
perf/avoid-temp-vec-add-sourcemap

Conversation

@Boshen
Copy link
Copy Markdown
Member

@Boshen Boshen commented Mar 20, 2026

Summary

  • Push tokens directly into self.tokens with inline deduplication of the first token, instead of collecting into a temporary Vec and then copying with extend_from_slice.

🤖 Generated with Claude Code

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 20, 2026

Merging this PR will degrade performance by 3.17%

⚡ 1 improved benchmark
❌ 2 regressed benchmarks
✅ 10 untouched benchmarks
⏩ 5 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
serialize[real_medium] 4.9 µs 5 µs -1.76%
add_sourcemap_loop 20.1 µs 20.8 µs -3.17%
from_sourcemaps 17.4 µs 15.7 µs +11.11%

Comparing perf/avoid-temp-vec-add-sourcemap (d7054c8) with main (152c2bb)

Open in CodSpeed

Footnotes

  1. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Push tokens directly into `self.tokens` with inline deduplication of
the first token, instead of collecting into a temporary `Vec` and then
copying with `extend_from_slice`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Boshen Boshen force-pushed the perf/avoid-temp-vec-add-sourcemap branch from 0ac781a to d7054c8 Compare March 20, 2026 13:30
@Boshen Boshen merged commit b45a772 into main Mar 20, 2026
7 checks passed
@Boshen Boshen deleted the perf/avoid-temp-vec-add-sourcemap branch March 20, 2026 13:32
@Boshen Boshen mentioned this pull request Mar 20, 2026
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.

1 participant