Optimize create.js Ticker with idle throttling and tab visibility handling #5800
Open
stutijain2006 wants to merge 2 commits intosugarlabs:masterfrom
Open
Optimize create.js Ticker with idle throttling and tab visibility handling #5800stutijain2006 wants to merge 2 commits intosugarlabs:masterfrom
stutijain2006 wants to merge 2 commits intosugarlabs:masterfrom
Conversation
Contributor
|
✅ All Jest tests passed! This PR is ready to merge. |
6e99803 to
d342a63
Compare
Contributor
|
✅ All Jest tests passed! This PR is ready to merge. |
kartikktripathi
approved these changes
Feb 19, 2026
Contributor
kartikktripathi
left a comment
There was a problem hiding this comment.
The idle throttling and visibility handling work correctly in testing.
Verified:
- No first interaction delay after idle
- Playback timing remains stable
- Background tab pause/resume works without tempo jumps
- Rapid tab switching does not create duplicate playback
- Ticker framerate restores correctly (60 → idle → 60)
npm run testwas run, and passed all the tests
The optimisation reduces unnecessary runtime work and behaves safely.
One small note: the recursive setTimeout idle check isn’t cleaned up if Activity is reinitialised, which could potentially create multiple loops in future refactors. Not blocking for this PR.
LGTM, Thanks for the contribution!
Contributor
|
@walterbender, I believe this PR is ready to be merged. |
Member
|
Can you either rebase or run prettier on activity.js? |
Contributor
Author
Done |
Contributor
|
✅ All Jest tests passed! This PR is ready to merge. |
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.
This PR introduces performance optimizations to reduce unnecessary CPU usage when Music Blocks is idle or running in the background.
Previously-
After this PR-
Runtime Impact-

Before: Main Runtime thread : 8469 ms
After : Main Runtime thread : 7371 ms

That is a reduction of 1100 ms in main runtime workload during a 30 sec interaction session.
This is a runtime efficiency optimization- not a lighthouse score improvements leading to -