https://kotlinlang.org logo
#webassembly
Title
# webassembly
c

corneil

02/20/2020, 7:38 AM
What is the expectation of performance comparing Kotlin/Native to Kotlin/WebAssembly? Or will it depend much more on the quality of the specific implementation used?
s

Svyatoslav Kuzmich [JB]

02/20/2020, 8:30 AM
Hard to tell. There are a lot of high level optimizations yet to be explored by Kotlin compiler, both for Native and Wasm platforms. Also, production-grade managed WebAssembly is not implemented yet. In theory, you can expect some overhead in WebAssembly related to sandboxing and CPU abstraction. Currently, in case of C/C++, you can find reports of 15-50% slowdown compared to native code, but this might not be representative for managed code. Expect that WebAssembly, for some period of time, will not able to share managed objects among threads. WebAssembly has startup overhead since it needs to be validated and compiled, but streaming compilation and compile caches would mitigate some of the delay. On the flip side, Wasm has a potential to be JIT-optimized and have better performance than statically compiled code in some cases. They would have different performance trade-offs related to garbage collection. Wasm engines are likely to use tracing GC while Kotlin/Native currently has ARC.
c

corneil

02/20/2020, 8:57 AM
Looks like JVM and Graal AOT is going to be gold standard for some time.
s

Svyatoslav Kuzmich [JB]

02/20/2020, 9:04 AM
Outside of the browser and Apple ecosystem - certainly
c

corneil

02/20/2020, 10:32 AM
Yes
3 Views