Is it possible for binaryen to optimise out most (if not all) of the kotlin runtime if you don’t use any of the stdlib and only stack types? I know previously the type section had a fair chunk of types which were unrelated to my code
b
bashor
11/28/2024, 6:41 PM
Mostly yes, still there is a bit room for improvement (Binaryen still unable to remove some data segments)
• For (1) optimized size is 568 Bytes
• For (2) optimized size is 411 Bytes
1.
Copy code
@JsExport
fun add(a: Int, b: Int) = a + b
2
Copy code
import kotlin.wasm.WasmExport
@WasmExport
fun add(a: Int, b: Int) = a + b