-
Notifications
You must be signed in to change notification settings - Fork 21
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
Add foreground FPS limit #16
base: master
Are you sure you want to change the base?
Add foreground FPS limit #16
Conversation
As reported in issue PathOfBuildingCommunity#13, PoB tends to use significant CPU and GPU resources while in the foreground. This change exposes a foreground frame rate limit that can be configured via a CVar (vid_fgfps) that defaults to a 30 FPS limit and allows a 5-120 FPS range. A setting of 30 feels responsive and reduces the resource usage by a modest amount. CPU usage hovers around 4% on my 16-core system with this change, as opposed to 6% usage with the current build. Similarly, GPU usage hovers around 18-20% with the 30 FPS limit and around 25-28% with the current build. There may be a better place to situate the sleep that is introduced for this, but this seemed like a reasonable place for someone who is not very familiar with this code. I also removed the reference to tiff.lib in the Debug configuration since that is unused and not a vcpkg dependency.
Tested this initially thinking it was going to have an impact on the speed of our various sorting subroutines, but it seems they either already block the UI until the calculation is done, or they're put on hold when the new frame is called, but keep running otherwise, so the difference was negligible. On my machine I saw 60 FPS on the old code (using Steam for a quick-and-dirty FPS counter), and 20 FPS with this new code. @dclamage if this works for you do you think we might be able to remove or change the code that eliminates processing when PoB is in the background? We could severely limit FPS when in the background, but allow sorting to continue processing, for example. |
Thanks for contributing! Would you be able to make the following changes?
Thanks! |
I'm not quite sure my interpretation of the bg/fg detection is correct or optimal, but the performance seems to be in line with what I would expect for both scenarios. |
As reported in issue #13, PoB tends to use significant CPU and GPU resources
while in the foreground. This change exposes a foreground frame rate limit that
can be configured via a CVar (vid_fgfps) that defaults to a 30 FPS limit and
allows a 5-120 FPS range. A setting of 30 feels responsive and reduces the
resource usage by a modest amount. CPU usage hovers around 4% on my 16-core
system with this change, as opposed to 6% usage with the current build.
Similarly, GPU usage hovers around 18-20% with the 30 FPS limit and around
25-28% with the current build.
There may be a better place to situate the sleep that is introduced for this,
but this seemed like a reasonable place for someone who is not very familiar
with this code.
I also removed the reference to tiff.lib in the Debug configuration since that
is unused and not a vcpkg dependency.