Introducing a new project, I'm working on for a fe...
# webassembly
r
Introducing a new project, I'm working on for a few weeks. Kilua is an experimental web framework for Kotlin/Wasm and Kotlin/JS. It's a very early stage, but I'm sharing the code. Any feedback is welcomed! Please check: https://github.com/rjaros/kilua
👍 13
🚀 3
2
p
What's different from kvision? - the wasm support
r
The main difference is the compose runtime usage
State management and reactivity is now the core of the framework. There is also no virtual DOM because compose takes care of DOM manipulation.
KVision api is fully imperative - you can build the layout by creating components and adding them to containers (other components). The reactivity in KVision is a bit strange, because it's based on this imperative api. In Kilua you still have components but you can't build layout with them. Only composable functions are used to create layout.
p
Gotcha, sounds like full rewrite 💪
r
Yes, it's a totally different framework (so no KVision2 or even KVision-NG but Kilua 🙂)
😸 1
But still I plan to make it very KVision friendly 🙂 Many parts of KVision application code will be fully working Kilua application code.
p
Sounds good
j
hey Robert this is really cool, nice work! I always liked KVision but didn’t do too much with it because I was being lazy and didn’t want to context-switch back into the imperative mode of thinking 😄 I will definitely be closely following Kilua, starred!
s
Looks interesting, do you have data points for the minimal amount of data to download for a hello world?
r
Currently 14K
main.bundle.js
(4K gzipped) + about 1.5M
wasm
file (342K gzipped).
s
Is the 1.5M coming from Compose infra ?
I am asking because I had related discussion with Compose team about that.
r
I think so, compose + coroutines.
s
Yeah, so that's the usual issue I would like to see solved one way of another.
r
Still not bad comparing to compose-web jetsnack example (9MB wasm file + 8MB skiko.wasm + 500KB skiko.js) 🙂
s
Sure!
I think the path you follow if the right one, we just need to optimize that minimal infra cost at some point
r
The same hello world compiled to JS target gives 427K bundle.
👍 1
s
And that require some design work
r
That size will grow a bit soon because
kotlinx.serialization
is coming to play 😉
Just learned about
applyBinaryen
option, which makes my hello-world example wasm file ~890KB (and just ~250KB gzipped).
s
Yes, this is a must have. Maybe it should be enabled by default 🤔
r
With more aggressive optimizations (https://kotlinlang.slack.com/archives/CDFP59223/p1699375103842319?thread_ts=1699023406.875839&cid=CDFP59223) the hello world size is now 460KB (134KB gzipped)!