-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Possible infinite loop in FrameLoop.ts update
method
#770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
update
methodupdate
method
This happens on high end machines as well, at least on Firefox. I am investigating performance issues on my app (on a macpro) and there is something very wrong going on. You can see that the FrameLoop is calling This causes everything to be super laggy. (on both v8 and v9-31) Use |
I think it has something to do with having lot's of Animated components rendered in the screen, and some Animated views inside other Animated views. If I render only one the issue doesn't happen, but if I render more things it happens. |
I made some investigations.
This improves things in development as well, took it from the mozilla docs: Globals.assign({
requestAnimationFrame: (cb?: (time: number) => void) => {
return window.requestAnimationFrame(t => {
setTimeout(() => {
if (cb) cb(t)
}, 0)
})
},
})
|
I don't know if the problem is an infinite loop, it seems to be more a "each step of the loop is too slow" so the loop takes a looooong time. Or they are two different problems. |
Ah, I see! I wonder if the jank is needed tho? At least in my case it seems to be causing more problems than it solves. We use react-spring in our product and support low end ie11 machines, where the problem gets very severe. I have a case where a transition animation between views always takes more than 200ms per frame. This causes the transition animation to always be janked on every frame and the animation never to proceeds and won't be able to finish. Causing it to get stuck in the animation loop. However if the jank is disabled these machines are still able to at least finish the animation. Frame rate is low, like 5 fps or something, but the animations finish and the app is usable. |
Yeah, you're right its not really an infinite loop, but never ending animation loop or something like that |
Fixed in #808 |
Uh oh!
There was an error while loading. Please reload this page.
🐛 Bug Report
Possible infinite loop in
FrameLoop.ts
update method on low end machines 📠In this part of the code (line 74):
What happens is when the delta time between two frames is longer than 64 ms
numSteps
will become0
and the animation won't move forward, causing it to get stuckTo Reproduce
Steps to reproduce the behavior:
Start a low end machine on vm where delta time between frames gets longer than 64 ms. Alternatively force the
numSteps
to always be zero.Expected behavior
Animations do not get stuck on low frame rate
Link to repro (highly encouraged)
https://codesandbox.io/s/fervent-carson-n4m3p
Environment
react-spring
v8.0.23react
v16.8.6Fix
Remove the line 74:
if (time > lastTime + 64) lastTime = time;
The text was updated successfully, but these errors were encountered: