…7418)
once more with feeling. the previous attempts were trying to put
schedule UI and network events on the same queue, which ... I don't know
what we were thinking :P
Anyway, this creates a proper FpsScheduler class that can take different
target rates which solves the issues we were seeing. But also, it solves
the fact that even without the 120fps change, we shouldn't be combining
these queues.
I recommend reviewing this PR with "hide whitespace" on. you'll note
that it had less changes than you would expect. it's really more about
just creating a JS class to encapsulate the throttle queue.
this lays the groundwork for the child PR here that does the network bit
of this: #7657
previous PRs: #6868 to
#6470
### Change type
- [ ] `bugfix`
- [x] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`
### Test plan
- [x] Unit tests (if present)
- [ ] End to end tests (if present)
### Release notes
- Improved performance by separating UI and network scheduling queues.
### API changes
- adds `FpsScheduler` to be able to create a FPS-throttled queue of
functions to execute
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Introduce per-instance FPS scheduling**
>
> - Add `FpsScheduler` class in `lib/throttle` with its own queue/state
and configurable target FPS; create a default 120fps instance and have
`fpsThrottle`/`throttleToNextFrame` delegate to it
> - Export `FpsScheduler` from `utils` (`src/index.ts`); update API
report accordingly
> - Add comprehensive unit tests (`lib/throttle.test.ts`) covering
throttling, next-frame batching, cancelation, and real-world scenarios
> - UI tweak: `DefaultDebugPanel` FPS readout now includes `maxKnownFps`
(`FPS ${fps} (max: ${maxKnownFps})`)
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
871ad95. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
parent PR: #7418
this makes just the solo mode change for better network usage.
pr-7657-walkthrough.mp4
Change type
bugfiximprovementfeatureapiotherNote
Optimizes network scheduling and reduces solo-mode traffic by using a dedicated FPS-based scheduler.
FpsSchedulerinstance inTLSyncClientto throttle network operations independently of UISOLO_MODE_FPS = 1,COLLABORATIVE_MODE_FPS = 30; updates target FPS based onpresenceModefpsThrottlewithfpsScheduler.fpsThrottleforflushPendingPushRequestsandscheduleRebasegetSyncFps()and callsupdateTargetFpsduring presence reactions; minor debug log on push sendfpsThrottle-based implementationsWritten by Cursor Bugbot for commit 2f029e7. This will update automatically on new commits. Configure here.