Goodnotes is using Swift with WebAssembly to bring it to Web • Need instant launch-time • Embedded Systems • Limited resources on storage size and memory size
options • ld64: -dead_strip • gold/lld: --gc-sections • Even public code can be eliminated if it’s unreachable from entry point or exported symbols • But cannot understand VTable / Witness Table entries, so they are always marked live conservatively Linker GC
options • ld64: -dead_strip • gold/lld: --gc-sections • Even public code can be eliminated if it’s unreachable from entry point or exported symbols • But cannot understand VTable / Witness Table entries, so they are always marked live conservatively Linker GC --gc-sections recently started working with Swift and WebAssembly!
• Periphery • Optimizers can remove them, but still better to remove by yourself • Reduce number of dependency libraries • Prefer system installed libraries
Minimum subset of runtime library • All generic functions are specialized • All modules are linked at SIL level, compiled into a single object le Swift Code Object File Swift Code Swift Code SIL LLVM IR SIL Optimizer LLVM Optimizer Swift Compiler
Minimum subset of runtime library • All generic functions are specialized • All modules are linked at SIL level, compiled into a single object le Swift Code Object File Swift Code Swift Code SIL LLVM IR SIL Optimizer LLVM Optimizer Swift Compiler Calls through protocols are always direct call!