Repository navigation
Move workout scoring and snapshot encoding off the main actor - #28
Closed
AlexSchmidt1999 wants to merge 2 commits into
Closed
AlexSchmidt1999 wants to merge 2 commits into
AlexSchmidt1999 wants to merge 2 commits into
Conversation
This was referenced Oct 10, 2026
Owner
Author
|
Replaced by #31, which retains this draft's commits and includes the tested build-454 UI update fix. The current device comparison will be recorded there. |
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.
Every accepted pulse sample used to score and JSON-encode the growing manual workout on the main actor. Encoding took most of the time in the local Release benchmark. Capture now keeps every sample and updates mean and peak immediately. One detached job scores the window, including its fingerprint, and encodes the existing snapshot. While that job runs, only the latest pending window is queued, with all accepted samples retained.
A result is applied only if its session and revision still match. Pause, resume, end, and background checkpoints invalidate older work before it can overwrite the UI or stored state. Checkpoints save the full window and the last completed live Effort estimate. Final saving uses the existing scoring and storage path. The snapshot key and format, Effort formulas, widget comparisons, and ActivityKit throttling stay the same.
On the local M4 Max, main-actor function time at 7,200 starting samples fell from 4.2842 to 0.7050 ms p95. The new timing adds capture and a valid result merge. It excludes scheduling and rendering. The benchmark report gives calculation, encoding, and main-actor measurements for all four sample counts.
Verification:
/varalias causes four pre-existing path-string comparison failures.This is Apple-only, with unchanged numerical and stored-data contracts. Raw device recordings remain local. The build-450 recording showed a 518 ms callback interval, but does not identify every cause. An iPhone comparison after installation is still needed to check how much this helps scrolling.
The PR targets the combined fork test branch so its diff contains just this work. Measurement and optimization are separate commits. The existing upstream PRs are unchanged.