perf: swap writer's spread-with-deltaTime for Object.assign - #81
Closed
elicwhite wants to merge 1 commit into
Closed
perf: swap writer's spread-with-deltaTime for Object.assign#81elicwhite wants to merge 1 commit into
elicwhite wants to merge 1 commit into
Conversation
tsup transpiles `{...ev, deltaTime: 0}` to __spreadProps(__spreadValues(...))
which iterates property descriptors — ~7% of total writer profile time was
spent inside __spreadProps. Object.assign({}, ev, { deltaTime: 0 }) is a
native builtin on V8 and 2-3× faster for small objects.
Applied at the three writer sites that clone-with-delta-reset a source
event: buildUnrecognizedTrack (top-level unrecognized MIDI tracks) and
the per-track unrecognizedMidiEvents passes in buildDrumTrack and
buildFretTrack.
Measured on writer autoresearch bench (2000 charts, 8 workers):
previous: 5.710 ms mean, 4.883 ms p50, 15.040 ms p95, 5.132s wall
now: 4.566 ms mean, 4.129 ms p50, 10.424 ms p95, 4.926s wall
delta: -20.0% mean, -30.7% p95
Second run (variance check): 4.609 ms mean — stable.
0 hash mismatches, 442/442 tests still green.
Cumulative: baseline 92 ms -> 4.57 ms, 20× faster.
This was referenced Apr 20, 2026
Owner
Author
This was referenced Apr 20, 2026
elicwhite
marked this pull request as ready for review
April 20, 2026 16:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

tsup transpiles
{...ev, deltaTime: 0}to __spreadProps(__spreadValues(...))which iterates property descriptors — ~7% of total writer profile time was
spent inside __spreadProps. Object.assign({}, ev, { deltaTime: 0 }) is a
native builtin on V8 and 2-3× faster for small objects.
Applied at the three writer sites that clone-with-delta-reset a source
event: buildUnrecognizedTrack (top-level unrecognized MIDI tracks) and
the per-track unrecognizedMidiEvents passes in buildDrumTrack and
buildFretTrack.
Measured on writer autoresearch bench (2000 charts, 8 workers):
previous: 5.710 ms mean, 4.883 ms p50, 15.040 ms p95, 5.132s wall
now: 4.566 ms mean, 4.129 ms p50, 10.424 ms p95, 4.926s wall
delta: -20.0% mean, -30.7% p95
Second run (variance check): 4.609 ms mean — stable.
0 hash mismatches, 442/442 tests still green.
Cumulative: baseline 92 ms -> 4.57 ms, 20× faster.