Hacker News new | ask | show | jobs
by anonova 2469 days ago
I was under the impression that it wasn't for performance but for distribution, i.e., to optimize for app size. Instead of having a fat binary crosscompiled for different architectures, Apple uses the bitcode to compile and distribute per architecture. It's part of the "app thinning" process.
4 comments

To expand on this, it also lets them target new CPU architectures without having developers recompile code for that architecture. This lets them make incremental improvements (eg armv7), but would also let them use their own CPU architecture should they move away from Intel/ARM.

As an example here’s Chris Lattner tweeting about that use case:

https://twitter.com/clattner_llvm/status/1091186386634326017...

> but would also let them use their own CPU architecture should they move away from Intel/ARM

Only if their new architecture looked a lot like Intel/ARM. Bitcode can’t paper over all architectural differences.

Regular bitcode cannot do it. However Apple has naturally customized it for their own purposes.

Not everything that Apple does lands on upstream.

I think you’re right that that is the primary reason today. In their marketing material I think they always use the term “reoptimize”, of course, that can mean for size.

Thanks for the correction.

App Thinning works just as well without bitcode. It’s just a process of removing unneeded architecture slices and resource variants from a downloadable app.
I guess this is good enough for Apple in practice, but LLVM bitcode is not platform independent in general.