Is your iOS app piling on weight? Blame Xcode 8.3: We shed light on Apple's bloat riddle

Developers puzzled by binaries' bitcode explosion

Apple's iOS 10.3 this week brought with it minor storage space gains, thanks to the debut of the iGiant's revised storage scheme, the Apple File System.

But among app developers, such efficiency gains, a gigabyte or two of extra capacity, were undone by binary bloat brought on by Apple's development suite Xcode, specifically the newly released version 8.3.

JP Simard, senior engineer with mobile database maker Realm, on Tuesday filed a bug report describing the issue on OpenRadar, a public bug report sharing site set up by developers Tim Burks and Chris Verwymeren in 2011 because Apple keeps its Radar bug reports private.

According to Simard, the Realm Objective-C iOS framework, when compiled with Xcode 8.2, measures 55MB. The same code, when compiled with Xcode 8.3 produces a binary weighing in at 158MB.

If this size inflation affected the application binary that gets distributed through Apple's App Store, it would be a major problem. Apple devices would suddenly find themselves short on space.

But issue matters only to developers because it inflates the bitcode associated with apps submitted to Apple for review. In particular, it's a concern for those developing watchOS apps, which are subject to a 100MB upload limit through Apple's iTunes Connect system and are required to include bitcode.

"Bitcode is an intermediate representation of a compiled program," Apple explains in its developer documentation. "Apps you upload to iTunes Connect that contain bitcode will be compiled and linked on the store. Including bitcode will allow Apple to re-optimize your app binary in the future without the need to submit a new version of your app to the store."

Specifically, Bitcode is a bitstream representation of LLVM IR.

In a phone interview with The Register, Simard said among Apple developers there's some controversy over the actual purpose of bitcode. "It's not clear whether Apple has ever made use of it or if they will," he said. "The process is a bit opaque."

Apple, secrecy fetishist that it is, did not respond to a request for comment.

While the stated purpose of bitcode is to allow Apple to recompile apps at a later time to include future optimizations or capabilities, Simard said, "there's no proof Apple has ever leveraged bitcode for anything."

Apple introduced bitcode about three years ago with Xcode 7, Simard said.

Simard suggested that Apple may have realized it need more app-related information to implement its recompilation scheme and added that data to its bitcode representation. He also speculated that the bitcode expansion could represent foundational work to enable support for future products.

"My personal theory is this is simply a bug arising from some internal change that increased the bitcode size, possibly just for some combinations of code," he said.

Simard is advising developers using Xcode to downgrade to an earlier version until the problem is addressed. "To avoid the bitcode explosion issue present in Xcode 8.3, I'd suggest using a previous version of Xcode that produces binaries with smaller bitcode slices," he said in a GitHub Issues post. ®

Biting the hand that feeds IT © 1998–2018