Pitch #3: Opt-in Reflection metadata

I agree that it would be best not to make this the default unless it can be made safe, but here’s some devil’s advocate perspective:

Disabling metadata on the default Vapor template reduced the binary (in release mode, Swift 5.6.1) from 32MB to 30MB

The Instagram app is 200mb installed today, according to the App Store. If it was written entirely in Swift, the binary size contribution of type metadata would probably be between 15 and 20mb (based on my anecdotal experience with the Uber apps and your number from Vapor, the contribution of type metadata is probably between 5-10% of the binary). I think it was 10mb for the Uber Rider app last we checked, and we are over 100mb in binary size.

So it’s not a trivial amount, especially if you’re a big company organized around the feature team model. I imagine if you’re trying to use Swift for some more systems oriented purpose it might also be useful to turn this off.

4 Likes