-
Notifications
You must be signed in to change notification settings - Fork 742
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
perf(x11): use a Timer instead of a DispatcherTimer for render callbacks #19054
base: master
Are you sure you want to change the base?
Conversation
@HakanL With this PR, the Uno app shouldn't be scheduled by the OS at all if there's nothing to do and should not be spin-waiting at all. Let us know if this fixes the problem. |
// running XConfigureEvent and rendering callbacks on a timer is necessary to avoid freezing in certain situations | ||
// where we get spammed with these events. Most notably, when resizing a window by dragging an edge, we'll get spammed | ||
// with XConfigureEvents. | ||
_timer = new Timer(static obj => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we conditionally stop the timer if we know we do not have anything to draw?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't directly pause the System.Threading.Timer
but I think there are ways to get around this, if we're careful enough. However, I don't think it matters. The Timer
actually sleeps (i.e. the equivalent of a Thread.Sleep) so waking up and immediately sleeping again 60 times a second should be more than fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue here is about CPU idle time, which may prevent CPU to go in low-power modes. It's generally best to avoid doing work we know nothing needs to be done.
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-19054/index.html |
@ramezgerges I'd be happy to test this on my RPi once you think it's ready to try. I haven't run my application with non-Nuget Uno (from source), do you have any docs on how to do that? I think last time I tried I wasn't able to successfully build it, but it was a while ago (may have been missing dependencies for Android, Mac, etc, since I'm only doing Win and Linux). |
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-19054/index.html |
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-19054/index.html |
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-19054/index.html |
|
GitHub Issue (If applicable): closes #19042
PR Type
What kind of change does this PR introduce?
What is the current behavior?
What is the new behavior?
PR Checklist
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Run
results.Other information
Internal Issue (If applicable):