flex-launcher
flex-launcher copied to clipboard
Save power when screensaver is active
We can save some power by skipping draw_screen() in the main loop when the screensaver is active and additionally delay all other routines by 1s. This saves 5-10 Watts on my home server.
I totally agree with you that Flex Launcher's drawing code is inefficient. It's not necessary to redraw the screen every single frame, and there are some optimizations that can be made.
However, it's not good to sleep for long periods in the main thread. The launcher needs to be checking for events and responding to them. Sleeping for long periods can lead to an unresponsive application. To merge this, I would need to see the following changes:
- Reduce the sleep period to less than 100 ms. Don't worry, this will not have a significant impact on CPU usage. It's really the screen drawing that's driving that.
- Check for the window event
SDL_WINDOWEVENT_EXPOSED, and always redraw the screen if it is received, even if the screensaver is active.