I was reminded of existence of this flag after taking a look the new swift-homomorphic-encryption's README, which although it requires Swift 5.10, it also mentions that:
@dimi mentioned this nice response from @Erik_Eckstein in another post to me:
So ... It appears the flag does still have some usage, and while CMO (cross-module-optimization) is enabled by default, explicitly enabling it will make it more aggressive?
And if code size doesn't matter much, one should enable that setting?
I just fully and cleanly recompiled our 200K LOC Server-Side Vapor app on swift-5.10-noble (amd64) and on release mode:
No CMO: 483.7 MB Docker image
With CMO: 482.94 MB Docker image
The CMO code had a "cleanup" commit in it, so I think I can just conclude that the size didn't really change at all with or without CMO explicitly enabled?
That's ... weird. I didn't expect the same code size with and without CMO explicitly enabled.
I'd also like to learn more about what exactly the more aggressive optimization does ā is it primarily reliant on libraries marking their members with @inlinable or @inline(...)?
How much of your Docker image is actually the text segment of your Swift binary? 0.75 MB of code is actually quite a bit; the entirety of the Standard Library on Darwin only has 3.76MB of code.
i would be reluctant to do that, not the least because it affects all other dependencies of that module, and not just the bits imported from swift-homomorphic-encryption.
I'm just trying to have a general idea, we're not using swift-homomorphic-encryption at all anyway.
I know it affects all the dependencies, and that's fine by me if it optimizes anything.
A bit more code size or a bit more CI time is not my concern.