TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Strange Issue: Does Window Visibility Affect Performance on OS X?

1 点作者 polymathist大约 10 年前
While writing some karma tests today for github.com&#x2F;soroushjp&#x2F;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.<p>Watch this screen recording: http:&#x2F;&#x2F;recordit.co&#x2F;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.<p>Am I right about my educated guess on what&#x27;s happening? Does OS X allocate more resources to windows that are visible?<p>FWIW this is on OS X 10.10.3, and I&#x27;m running the latest version of all browsers shown.

1 comment

DiabloD3大约 10 年前
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.<p>It is part of their battery saving stuff.
评论 #9417720 未加载