Four ways OS X Mavericks will save your MacBook's battery
When Apple unveiled the iPad in 2010, I immediately fell in love with its impressive battery life, and couldn’t wait until they day when the same longevity would come to my Mac.
With the upcoming release of OS X Mavericks and the latest round of revisions to the company’s laptop hardware, it looks like I (alongside, I suspect, many other Mac users) could finally get my wish, thanks to a few clever software tricks that have found their way into the latest incarnation of Apple’s desktop operating system.
Hardware and software
The obvious way to improve battery life in a laptop is to increase battery capacity and decrease the electrical consumption of the machine’s hardware components, both goals that Apple has been pursuing zealously for some time by changing the way that its computers are manufactured.
For example, the introduction of the unibody design allowed the company to fit its computers with custom-molded batteries that provide superior capacity in a relatively compact space. The company also continues to adopt the latest technologies, like solid-state drives and Intel’s newest CPUs, to make its hardware less power-hungry.
Hardware improvements, however, usually require sweeping technological changes, and are often at odds with users who demand computers that are ever more compact, lightweight, and powerful at the same time. Apple could easily double the longevity of the MacBook Air by tacking a couple extra pounds of batteries at the back—but such a move would be unlikely to go over well with either the design-conscious company or its consumers.
In addition to continuously tweaking its hardware, therefore, the company has also been investing in the software side of its products. Mavericks, due out later this fall, promises to introduce a few interesting technologies aimed at increasing the battery life of our computers.
The first, called App Nap, simply causes apps you’re not actively using to receive less of the system’s attention, reducing their power demands in the process.
When an app’s windows are invisible and the app is not playing back audio, it enters “nap mode,” at which point three things happen: First, its priority is reduced, decreasing the amount of active execution time that the CPU dedicates to it; second, its ability to access devices, such as the hard disk or the network, is throttled, limiting the power drain caused by input/output operations; and third, the app’s timers are fired less frequently, causing it to become active only after longer intervals.
Together, these three techniques greatly reduce the demands that an inactive app makes on the system, which significantly reduces its power consumption. A collateral benefit is that more of the computer’s capacity is reserved for the the currently active app, which becomes more responsive as a result.
Obviously, not all apps can work under these conditions. It would be absurd to be forced to, say, keep QuickTime Player in the foreground while it’s encoding a video just to prevent it from being put into power-saving mode. For this reason, Mavericks allows individual programs to opt out of App Nap as needed.
Small is beautiful
RAM is always a precious resource. Because every app needs it, and because it needs to be very fast, having plenty of memory available is often crucial to ensuring optimum system performance.
In fact, RAM is so important that most operating systems extend a computer’s hardwired memory by storing it on the hard drive as needed. This virtual memory, as it’s called, ensures a nearly unlimited supply of memory, but at the cost of increased hard-disk activity and reduced performance.
Mavericks extends the concept of virtual memory by introducing a new technique called Compressed Memory. As its name implies, this system works by transparently compressing the portions of RAM that, though nominally in use, are not actively employed by any app. Doing this increases the free memory available to the system without requiring disk swapping.
Because the algorithm used to compress the memory is very efficient, this process is much faster than traditional disk swapping—and, because it requires fewer trips to the hard disk, it also ends up saving more power by preventing the physical disk from spinning up and down continuously. As an added bonus, computers that use SSDs will also incur less wear and tear, which will increase the longevity of their hardware components.
Time keeps on slippin’
Apple’s third power-saving technique relies on the fact that almost all apps schedule tasks to occur at specific intervals in the background by using a software construct called a timer. Because apps have no way of coordinating with each other, these timers fire in an often chaotic way, continually forcing the CPU to exit power-saving mode, execute a few lines of code, and then go back to sleep.
With Mavericks’s Timer Coalescing feature, when a computer is running on battery power, the operating system will automatically aggregate timers that are scheduled to fire within a short time of each other and execute them concurrently, thus reducing the number of times the system is forced to enter and exit power-saving mode and increasing the time it spends idling (during which power consumption is at a minimum).
Apple has long told developers that they shouldn’t count on the absolute accuracy of a timer, noting that many external conditions, such as system load, could delay (or even accelerate) their firing in unpredictable ways. Therefore, Timer Coalescing should work right out of the box, without requiring programmers to tweak their code.
Plug me out, turn me up
In addition to these sweeping under-the-hood changes to the upcoming version of OS X, Safari 7 features a new Power Saver feature that keeps plug-ins disabled until the user needs them. Thus, for example, if you open a webpage that contains one or more Flash movies, the browser will show a static preview instead of launching a movie automatically. Clicking the preview activates the plug-in, but if you don’t click it, the plug-in won't consume any additional power.
Media playback is also getting a few tweaks. According to Apple, iTunes will take greater advantage of the hardware acceleration provided by a Mac’s GPU, reducing the amount of power needed to watch movies and play music by as much as 35 percent.
Finally, the upcoming version of OS X will also be able to take better advantage of the Haswell processor’s support for firing up and boosting the clock speed of individual cores, ensuring that each core is fully utilized before a new one is brought online and allowed to eat up more power.
Apple at its best
Altogether, the power-management features in Mavericks paint a picture of an operating system in which great care as been taken to squeeze every last drop of battery performance out of both hardware and software.
The nature of the changes, however, is as interesting as their effects. Many of the power-saving techniques in Mavericks are borrowed from other vendors—for example, Windows has long supported timer coalescing (although as an opt-in technology), and Safari extensions like ClickToFlash can already be used to prevent plug-ins from draining CPU resources and battery life unless called upon by the user.
Their systematic inclusion in the operating system, however, highlights Apple’s knack for thinking laterally and making iterative improvements; as a result, almost every user will experience a dramatic improvement in battery life and system responsiveness without ever having to worry about what goes on under the hood—exactly the kind of experience we’ve come to expect (and love) from our Macs.
Even better, we can expect Apple’s enthusiasm for power saving to trickle down to third-party developers, who will be encouraged to discover new ways to tweak their software’s power consumption. This could produce a virtuous circle that would finally make disappointing battery life a thing of the past, and allow for even thinner and more-efficient computers—without requiring us all to wait for the next technological breakthrough.