Skip to content

Conversation

@chiefcll
Copy link
Contributor

Setting targetFPS to 30 resulted in only getting ~20 fps. Due to improper logic with setTimeout & raf delay.

@jfboeve jfboeve requested a review from wouterlucas January 13, 2026 09:30
@wouterlucas
Copy link
Contributor

Although this simplifies it a lot by just hooking to rAF again - I can't move forward with this.
The problem is certain devices do not enjoy the rAF being called excessively and that caused extra load for the underlying compositor layers - hence we added the idle disengage from rAF to mitigate that.

The changes you are proposing basically add additional rAF calls for waiting periods when we're too early, this will be counter productive for the devices that suffer from additional load when calling rAF.

Also when you measure FPS - how are you measuring, device / compositing output or browser reported FPS?

@chiefcll
Copy link
Contributor Author

Understood - I've just pushed up some tweaks. The Renderer reports back an FPS that is significantly less than the targetFPS variable.

I've updated the timing with the setTimeout so that it calls the rAF hopefully "before" the next frame. What is happening is the setTimeout is causing the rAF to be called on the following frame. I've also changed the 16.66666 to 15 so the next rAF will be called rather than missing a frame.

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.

2 participants