微软nap_什么是App Nap? 它会降低我的Mac应用程序速度吗?

微软nap

微软nap

mac-app-nap-sleeping

App Nap, added to macOS back in 2013, is not a feature that made headlines. So there’s no shame in admitting, three years later, that you still have no idea what it does.

App Nap于2013年添加到macOS中,但并未成为头条新闻。 因此,三年后承认您仍然不知道它的作用并没有什么可耻的。

To summarize: App Nap puts programs you’re not currently using or looking at to “sleep”, blocking them from using system resources, especially the CPU, until you focus on them again. If you have 20 windows open, only the things you’re currently using should be using system resources and battery life. The energy savings can add up.

总结一下:App Nap会将您当前未使用或正在查看的程序“睡眠”,阻止它们使用系统资源(尤其是CPU),直到您再次关注它们。 如果您打开20个窗口,则只有您当前正在使用的东西会占用系统资源和电池寿命。 节省的能源可以累加起来。

App Nap should not be confused with Power Nap, a similarly named feature which allows your Mac to do things like download updates or create backups while suspended. The two features are unrelated.

App Nap不应与Power Nap混淆, Power Nap是一种类似的功能,可让您的Mac在暂停状态下执行下载更新或创建备份之类的操作。 这两个功能无关。

App Nap会做什么 (What App Nap Does)

App Nap was one of the energy features added with macOS (then OS X) 10.9 Mavericks. Other tweaks include a list of “Apps Using Significant Energy”, which was added to the battery icon.

App Nap是macOS(当时为OS X)10.9 Mavericks新增的功能之一。 其他调整包括“使用大量能源的应用程序”列表,该列表已添加到电池图标中

energy-wasting-app

App Nap is a related optimization, blocking inactive applications from using the CPU and other system resources. This keeps your computer’s resources free, and saves battery life.

App Nap是一项相关的优化,可以阻止不活动的应用程序使用CPU和其他系统资源。 这样可以使计算机的资源保持空闲状态,并节省电池寿命。

When is an application considered “inactive”? According to Apple’s developer guidelines, App Nap is triggered only if an application:

什么时候将应用程序视为“非活动”? 根据Apple的开发人员指南 ,只有在以下情况下才触发App Nap:

  • Isn’t the foreground app.

    不是前台应用程序。
  • Hasn’t recently updated content in the visible portion of a window.

    最近尚未更新窗口可见部分中的内容。
  • Isn’t audible.

    听不到。
  • Hasn’t taken any IOKit power management or NSProcessInfo assertions.

    尚未执行任何IOKit电源管理或NSProcessInfo断言。
  • Isn’t using OpenGL.

    不使用OpenGL。

What does this mean? First of all, the application that you’re currently using will not go to sleep. The same goes for any application that you can currently see, assuming the part of the window you can see is currently getting updates. Any application that’s making sounds also will not go to sleep, which is good news if you like to leave your music player running in the background.

这是什么意思? 首先,您当前正在使用的应用程序不会进入睡眠状态。 假设您可以看到的窗口部分当前正在获取更新,您当前可以看到的任何应用程序也是如此。 任何发出声音的应用程序也不会进入睡眠状态,如果您想让音乐播放器在后台运行,这是个好消息。

The idea here is that any application that’s not currently doing anything for you should not be using up any of your resources. Applications wake up as soon as you open their windows again, and in theory this shouldn’t affect performance at all (except in a positive way, by leaving resources open for the apps you’re actually using).

这里的想法是,任何当前没有为您做任何事情的应用程序都不应耗尽您的任何资源。 再次打开它们的窗口后,应用程序就会唤醒,并且从理论上讲,这完全不会影响性能(以积极的方式除外(通过为实际使用的应用程序保留资源)。

如何检查应用程序当前是否正在小睡 (How to Check if an App Is Currently Napping)

App Nap is not, broadly speaking, a user-facing feature. There is no indicator, on the dock or otherwise, that shows you whether an application is currently napping. For that, you need to head to the Activity Monitor, which you can find in Applications > Utilities, or by searching Spotlight.

从广义上讲,App Nap并不是面向用户的功能。 在扩展坞上或其他位置没有任何指示器可显示您当前是否正在小睡应用程序。 为此,您需要转到“活动监视器” ,可以在“应用程序”>“实用程序”中找到,或者通过搜索Spotlight。

app-nap-activity-monitor

Head to the “Energy” tab and you’ll see a column for “App Nap.” A “Yes” here means that a given application is currently napping. Open the application in question and it will instantly wake up, and Activity Monitor will read “No” in the column.

转到“能源”标签,您会看到“应用小憩”一栏。 这里的“是”表示给定的应用程序正在小睡。 打开有问题的应用程序,它将立即唤醒,并且“活动监视器”在该列中显示为“否”。

The idea is for applications to wake up so quickly that users don’t even notice the nap happened. But if you think this might be slowing some of your apps down, you might have recourse.

这个想法是为了使应用程序如此Swift地唤醒,以至于用户甚至都不会注意到发生了小睡。 但是,如果您认为这可能会减慢某些应用的运行速度,那么您可能有追索权。

如何全部或针对某些应用禁用Nap (How to Disable App Nap, Entirely or for Certain Apps)

App Nap is applied to all applications, regardless of whether they were built with the function in mind or not. This could, at least in theory, cause problems for certain older apps, preventing background updates or causing slowdowns. If you suspect App Nap is causing problems, there’s an easy way to find out.

App Nap适用于所有应用程序,无论它们是否在构建时都考虑了该功能。 至少从理论上讲,这可能会导致某些较旧的应用程序出现问题,从而阻止后台更新或导致速度下降。 如果您怀疑App Nap引起了问题,有一种简单的方法可以找出来。

First, find your application in Finder, then right-click it.

首先,在Finder中找到您的应用程序,然后右键单击它。

spatterlight-right-click

Click “Get Info”, and you might see the option to Prevent App Nap.

单击“获取信息”,您可能会看到“阻止应用程序Hibernate”选项。

get-info-disable-app-nap

The option won’t be offered for every app; generally the option is only seen if applications weren’t specifically created with App Nap in mind. In our experience, this means the option primarily shows up for applications built in 2013 or earlier, though there are exceptions. If possible, disable App Nap for your program and see if your problem is solved.

不会为每个应用程序都提供该选项。 通常,只有在没有专门考虑App Nap创建应用程序的情况下,才会看到该选项。 根据我们的经验,这意味着该选项主要针对2013年或更早版本中构建的应用程序显示,尽管有例外。 如果可能,请为您的程序禁用App Nap,然后查看问题是否解决。

Alternatively, you can disable App Nap entirely with a single command. Open the Terminal, which you can find in Applications > Utilities or by searching with Spotlight. Then run this command:

或者,您可以使用单个命令完全禁用App Nap。 打开终端,您可以在“应用程序”>“实用程序”中找到该终端,也可以通过使用Spotlight搜索。 然后运行以下命令:

defaults write NSGlobalDomain NSAppSleepDisabled -bool YES

defaults write NSGlobalDomain NSAppSleepDisabled -bool YES

This will disable App Nap entirely. If doing so fixes a problem you’ve had with an app, consider writing that app’s developer and letting them know. Once you’ve done that, you can re-enable App Nap with this command:

这将完全禁用App Nap。 如果这样做可以解决您在使用应用程序时遇到的问题,请考虑编写该应用程序的开发人员并告知他们。 完成此操作后,您可以使用以下命令重新启用App Nap:

defaults delete NSGlobalDomain NSAppSleepDisabled

defaults delete NSGlobalDomain NSAppSleepDisabled

App Nap is, overall, a feature worth keeping enabled unless you specifically have a problem. The better battery life alone makes the feature worthwhile, and most users will never notice that anything is even happening. But it’s good to know how to disable things just in case.

总体来说,除非您特别遇到问题,否则App Nap是一项值得保留的功能。 光是电池寿命越长越好,该功能就值得了,大多数用户甚至都不会注意到正在发生任何事情。 但是最好知道如何禁用它以防万一。

Photo credit: Arthur Caranta/Flickr

图片来源: Arthur Caranta / Flickr

翻译自: https://www.howtogeek.com/277414/what-is-app-nap-is-it-slowing-down-my-mac-apps/

微软nap

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值