-
Notifications
You must be signed in to change notification settings - Fork 2.4k
use NtDelayExecution for SDL_SYS_DelayNS #13816
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
base: main
Are you sure you want to change the base?
Conversation
092c1ef
to
befab1c
Compare
How really good an idea is using an undocumented NT call and linking to ntdll.dll for it? |
I'm not sure. @expikr, can you provide details on the testing that you did and the results that you got that convinced you that this is an improvement? I'm not opposed to this being an option, but it should not entirely replace the existing code. Can you please adapt your change to switch between this approach and the original approach via If we decide we want to go this way, we can remove the old code and switch to static linking in a separate step. |
TBH I didn't really test very rigorously to positively benchmark an improvement, mainly more just reading that it provides 100ns precision and has been a stable API since the very beginning of windows as it's the underlying syscall used by all the sleep and wait related win32 APIs, so just briefly plopped it into a test app and look at the FPS counter to confirm my bias. I've made the requested changes. I'll write a more proper benchmark using QueryPerformanceCounter and report back. |
Might also be worth testing against |
I have used these before in combination with other undocumented functions to get delays more useful for timers combined with waiting on overlapped I/O completions, but don't see its utility for simple sleep situations especially now that there's the high resolution waitable timers. |
This has a much more stable timing behaviour from my testing in statically linked usercode.