Hacker News new | past | comments | ask | show | jobs | submit login

Hmm, so it includes the entirety of Swift's standard library? Isn't there an option to tree shake/trim it? That's what .NET AOT compilation does (standard library is always included, sans the dependency on glibc or musl, which you can statically link into the binary as well should you need that)



The biggest symbol of a statically linked swift binary that I have, is icudt_swift65_dat with 27.98MB, so I think that's not so easy to remove (nm v3.1.2 --size-sort --radix=d|swift demangle) And I think if you strip debuginfo it will be smaller (For a statically linked program of mine: 98MB -> 56MB)

But I think for a distribution it makes more sense to link swift programs dynamically against the runtime libraries, like it's the case for e.g. the C standard library, OpenSSL etc., as you can assume they all work with the same version and are ABI-compatible.

I tested it with a nearly static build (Still links against glibc and friends): 55MB get stripped to 44MB, so not that much. 27MB of that is icudt_swift65_dat, so I guess you would have to optimise that first


With the new Foundation work going on, when you migrate to that, if you don't import `FoundationInternationalization` then you won't pull in all of ICU and it won't be bundled in


If I’m not mistaken, the embedded swift mode aims to make ICU (the 27mb file for Unicode support) optional (and thus easily removed where it isn’t needed)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: