swiftwasm / swift

WebAssembly support for the Swift programming language
https://swiftwasm.org
1.28k stars 28 forks source link

WASM files are quite large? #5559

Open KevinVitale opened 8 months ago

KevinVitale commented 8 months ago

Description

Long-time Swift dev here, dipping into this WASM project for the first time. This Swift file prints "Hello, WASM":

> main.swift:
print("Hello, WASM!")

The file generated is 6MB+:

$ ls -al main.wasm
$ 6.35M 03.Nov'23 13:50  main.wasm

Questions

kateinoigakukun commented 8 months ago

Unfortunately it's a typical size of wasm binary produced from Swift today. There are several known inefficiencies in the toolchain due and we are hardly working on improving it. You might be able to find some useful resources in https://github.com/swiftwasm/swift/issues/7

esummers commented 7 months ago

The upcoming Embedded Swift features will allow much of the overhead (reflection, unused code, etc.) to be stripped out of WASM builds, but that is still in early development.