https://kotlinlang.org logo
Title
t

tunedal

10/21/2021, 4:40 PM
How much does the Wasm backend improve the size of the generated code compared to the JS IR backend?
s

Svyatoslav Kuzmich [JB]

10/21/2021, 4:45 PM
We haven't integrated dead code elimination to K/Wasm yet. Code size measurements are not very useful until then.
t

tunedal

10/21/2021, 4:50 PM
Ah, I see. But it's expected to generate smaller code than Kotlin/JS once DCE is implemented, right?
s

Svyatoslav Kuzmich [JB]

10/21/2021, 4:54 PM
I would expect higher constant overhead because in K/JS we use built-in library for things like math, strings and arrays. But overhead multiplier for user defined code should be lower because of compact byte-code. To sum it up - smaller size for large projects and bigger size for tiny projects.
👍 1
t

tunedal

10/21/2021, 4:59 PM
Interesting. I noticed that the size of generated code with Kotlin/JS seemed to grow quite quickly as the project grew, so maybe the project doesn't have to be all that big to benefit. Thanks.
s

Svyatoslav Kuzmich [JB]

10/21/2021, 5:02 PM
These is just my intuition. We'll have to measure and see.
I would also expect Wasm code to start running faster after it is downloaded, compared to the same size JS.
t

Trevor Stone

10/21/2021, 5:41 PM
Also can get the benefits of parallelism right