Skip to content
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

Spinning square demo stutters on Windows 10 #234

Open
ninjasource opened this issue Apr 13, 2020 · 5 comments
Open

Spinning square demo stutters on Windows 10 #234

ninjasource opened this issue Apr 13, 2020 · 5 comments

Comments

@ninjasource
Copy link

ninjasource commented Apr 13, 2020

Hi, thanks for your great demo. I recorded the spinning square using a high framerate video camera (I used my phone at 240fps) and noticed that there is a brief pause every 10 frames or so. At normal speeds this manifests itself as a slightly jerky rotation. This happens on both low and high DPI screens but it is more obvious on high DPI screens because the square is sharper. I have a decent graphics card and cpu. Has anyone else noticed this?

@bvssvni
Copy link
Member

bvssvni commented Apr 15, 2020

Did you run in release mode? Debug mode in Rust can be slow.

@ninjasource
Copy link
Author

ninjasource commented Apr 16, 2020

Unfortunately it happens on release builds too. I also checked and nothing else (of significance) was running on my machine at the time.

Some more information:
When I run the release build exe from the command line directly (no cargo) it consumes 0-0.1% CPU on task manager and 30MB memory.
CPU: i7-6700K 4 core at 4GHZ in High performance plan
32GB Ram
NVidia GeForce GTX 1070
Windows 10 Enterprise 2016 LTSB

Same thing happens on the following machine (although it happens every 6 or so frames):
Intel Nuc i7-8559U 4 cores @ 2.7GHz with built in Intel graphics
Windows 10 Enterprise 2019

Lastly, it does not appear to happen on Ubuntu on a somewhat aging laptop of mine so I assume that this is a Windows only issue.

Setting the process priority to High or even Realtime makes no difference in Windows so this may not be related to process context switching.

@bvssvni
Copy link
Member

bvssvni commented Apr 20, 2020

Perhaps you could detect this spike by logging idle time:

The idle event is emitted before going to sleep, so if the game loop works harder at irregular intervals, it might have less time to idle.

@bvssvni
Copy link
Member

bvssvni commented Jul 9, 2020

This might be caused by varying update vs rendering. Using extrapolated time at rendering might fix the problem.

@ninjasource
Copy link
Author

ninjasource commented Jul 14, 2020

Hi bvssvni,

Thank you for your comments. I have tried quite a few things now and it appears as if there is jitter on the events.next() function which is apparent when you log an entry to the console every iteration. Sometimes the latency is more than a frame so I guess what I am seeing are dropped frames rather than a badly timed rotation function. There is quite a lot of variation in IdleArgs in the IdleEvent and I periodically get two idle events before an UpdateEvent. I don't really know what that means though. I am a little out of my depth here as I am not a graphics or game developer so I don't know how much help I can really be. If I log to the console in a simple 10ms delay loop on another thread I don't get any jitter so at least windows is not freezing the entire process periodically. Feel free to close this issue if you like as I doubt that I will be able to solve it.

Regards,
David

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants