What is the expectation of performance comparing K...
# webassembly
c
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
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
Looks like JVM and Graal AOT is going to be gold standard for some time.
s
Outside of the browser and Apple ecosystem - certainly
c
Yes