Skip to content

A spring keeps its last answer for tracks asking at the same time - #600

Merged
wingleeio merged 1 commit into
mainfrom
sol/spring-memo
Oct 26, 2026
Merged

wingleeio merged 1 commit into
mainfrom
sol/spring-memo

Conversation

@wingleeio

@wingleeio wingleeio commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

A tween's tracks share its ease (one Rc<Spring>) and its timing, so every track of a tween asks its spring for the same time each frame. A ui.each reorder with animate moves a thousand rows in one tween, two tracks a row: two thousand solves a frame (each an exp and a sincos) for one number. Spring now keeps the last time it was solved at (its bits) and the answer; the same bits get the same answer back. The settling-time search still calls solve directly.

Exact by construction: new test a_spring_answers_a_time_asked_again_as_solved checks the kept answer against a fresh solve bit for bit, for repeated, interleaved, signed-zero and NaN times. zgx-script: 538 tests pass; clippy and fmt clean.

Gate-style cachegrind, all scenes (origin/main vs this):

scene main this
script-layout 3787.8 M 3299.2 M −12.90%
list-state 828.1 M 826.1 M −0.24%
every other scene −0.02 … +0.04%
mount 323.9 M 324.2 M +0.07% in the sweep; three repeats each: main 324.03–324.22 M, this 323.97–324.28 M
anime 3840.2 M 3841.4 M +0.03% in the sweep; repeats overlap (main 3839.8–3841.1 M, this 3839.9–3841.6 M)

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

A tween's tracks share its ease and its timing. A list's rows moving
together (a `ui.each` reorder, the layout boxes' default spring) each
asked the same spring for the same time every frame: two tracks a row,
each an exp, a sine and a cosine, a thousand rows a frame for the same
number. The spring now remembers the last time it was solved at (its
bits) and the answer, and gives that answer again, bit for bit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Instruction counts (cachegrind, exact) against aaf35528; the gate fails above +1%.

scene base head change
heavy-both 1,415.7 M 1,415.7 M -0.00%
heavy-stream 1,359.3 M 1,359.3 M +0.00%
heavy-scroll 80.4 M 80.4 M +0.01%
lab-stream 462.0 M 462.1 M +0.00%
lab-scroll 70.3 M 70.3 M +0.01%
animate 397.6 M 397.6 M +0.00%
micro-state 59.7 M 59.7 M +0.00%
micro-vscroll-fixed 48.8 M 48.8 M -0.03%
micro-vscroll-variable 89.1 M 89.1 M -0.03%
micro-state-luau 82.9 M 83.0 M +0.01%
micro-vscroll-fixed-luau 66.3 M 66.3 M -0.01%
micro-vscroll-variable-luau 134.7 M 134.6 M -0.03%
mount 326.8 M 327.2 M +0.13%
script-update 1,699.9 M 1,700.2 M +0.01%
anime 4,792.0 M 4,791.7 M -0.01%
script-layout 4,001.6 M 3,479.1 M -13.06%
list-state 893.6 M 894.5 M +0.10%
style 2,146.7 M 2,146.7 M -0.00%
widgets 2,685.2 M 2,685.2 M +0.00%
app-mail 318.9 M 319.0 M +0.03%
app-chat 53.2 M 53.2 M +0.07%
app-dashboard 189.8 M 189.8 M +0.01%
app-dashboard-sort 126.5 M 126.5 M +0.01%
app-sketch 48.5 M 48.5 M +0.03%
app-code 100.0 M 100.0 M +0.03%
app-code-search 87.6 M 87.7 M +0.04%

@wingleeio
wingleeio merged commit 1ee0c3c into main Oct 26, 2026
4 checks passed
@wingleeio
wingleeio deleted the sol/spring-memo branch October 26, 2026 05:56
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