Monday, July 22, 2024

How Apple has supercharged app launching in iOS 15 and macOS Monterey

How Apple has supercharged app launching in iOS 15 and macOS Monterey

When you fire up iOS 15 and macOS Monterey for the first time this fall, you’re probably going to notice something beyond the new FaceTime features and Safari changes: improved speed. According to a developer who has delved into the code for Apple’s new operating systems, Apple has significantly changed the way apps communicate with the system and it could dramatically cut down on the time it takes to launch.

iOS developer and former Apple employee Noah Martin became aware of an intriguing bit while reading the release notes of Xcode 13:

All programs and dylibs built with a deployment target of macOS 12 or iOS 15 or later now use the chained fixups format. This uses different load commands and LINKEDIT data, and won’t run or load on older OS versions.

It might not sound like much, but those two sentences explain the technology that could change your experience with your Mac and iPhone. Martin has done some detective work to see what’s behind this change and as he describes in a lengthy and very technical Medium post, apps optimized for iOS 15 and macOS 12 are likely to launch much faster than they do now.

How it works

As iOS and macOS currently work, all apps are created as bundles. Unlike on Windows, apps are equipped with the most necessary components within a package. Apps are basically folders that contain all sorts of program components. (If you have a Mac, you may know that. Right-click on an app in the Finder and you’ll see the menu item “Show Package Contents” that allows you to look inside the app.) In addition, apps also load shared libraries with the dynamic linker process (dyld), which are then copied to the system’s RAM to be quickly accessed while the program is running.

The RAM consists of so-called pages that have only 16 kilobytes of capacity each and stay as long as the app is running. The dyld process has so far gradually packed these tables, which essentially delayed app launches. As Martin has learned, Apple solved the problem in iOS 15 and macOS 12 with chains, fixups and pointers—instead of gradually loading the individual app components and the shared libraries separately into RAM, a pointer can thus chain apps up to 64 gigabytes and connect them to each other via the fixups.

It sounds complex, but it’s simple. The RAM content is now interconnecting to each other in a chain. This saves enormous amounts of metadata that is otherwise spent on management, which makes the entire RAM management much more efficient. In addition, RAM pages that have not been used for a long time are compressed.

According to Martin, this new system has two results. The amount of available memory is optimized, and the targeted distribution of binary content in memory ensures faster app launches. In his tests, Martin was able to save up to 50 percent in metadata, which is imported via the dyld process and ultimately allows apps to start faster.

We’ll see how this works soon enough. Apple has already released the third beta of iOS 15 and macOS 12 for a likely release in September and October, respectively.

Similar Posts