Adaptive Performances

My last demo uses CPU intensive graphics. I hacked the code a little bit to adapt the performances to the CPU power and activity. Basically, the application computes the time taken by the last painting phase and change its behavior accordingly. In the case of Follow The Curves, each painting should be done in 50 to 100ms. If it takes 1.5 times that time, then anti aliasing is disabled. If it takes more than 2 times that time, one of the curves is dropped. If it takes more than 2.5 times that time, the remaining curves are dropped. Therefore, on very slow computers, only the background will remain (you can see that by maximizing the window).

This quick hack is far from perfect. First, it introduces flickering since the time-filter is based on the last frame only. It should be based on an average to be more accurate. Also this does not really lighten the CPU load because the animation timer has still a delay of 50ms. Well, at least, this doesn't lighten the CPU load when you go full screen. If you keep the window at its original size, slower computers should perform better.

You can read the source code.

Comments are closed.