Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Strange Issue: Does Window Visibility Affect Performance on OS X?
1 point by polymathist on April 21, 2015 | hide | past | favorite | 2 comments
While writing some karma tests today for github.com/soroushjp/humble, I noticed something really strange. Sometimes the tests would take a long time to run (3-10s) and sometimes they would run in less than a second. After some experimentation I figured out how to consistently reproduce the results.

Watch this screen recording: http://recordit.co/R30bQ3ZowE. I have three different browsers open and connected to Karma (Chrome, Safari, Firefox). When the browser windows are visible, the tests run in under a second. When I cover up the browser windows with another window, the tests take much much longer. Safari even disconnects because it was taking too long. I was really skeptical at first, but I repeated the test many times and always got the same results.

Am I right about my educated guess on what's happening? Does OS X allocate more resources to windows that are visible?

FWIW this is on OS X 10.10.3, and I'm running the latest version of all browsers shown.




From my experience with dealing with OSX, yes, OSX tries to optimize apps (usually by force) by increasing the time their threads sleep depending on if they have a window on screen or not.

It is part of their battery saving stuff.





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: