It seems `.klib` is specifc to native so I guess i...
# javascript
s
It seems
.klib
is specifc to native so I guess it is not usable for Javascript ...
k
sdeleuze: Yes, but I believe it's possible to reuse and refactor code that creates and reads klib to support cross-platform format. And yes, it's my personal desire to have such format of distibution. JS has proven to be awful in this role
👏 2
👍 2
s
That would be a game changer for Kotlin frontend effort I think
As a side note, it could also maybe enable to generate some computer intensive part with WebAssembly, providing an unified and flexible JS + WASM approach
g
@konsoletyper what is your current strategy for the desired tree shaking feature? Is it source code analysis based?
k
It's based on analysis of generated JS code
g
Can it be really performant?
k
It's pretty fast. I tried it with about 5mb of generated JS code and it works for several seconds.
And yes, as for digits. It reduced JS code down to 3mb
g
My question was more on the resulting code. We saw that tools like google closure were not that performant on tree shaking. Is the generated code structured enought to remove all the dead code?
k
It's structured enough to remove most of dead code. And it's impossible to remove "all dead code"
g
Is the kotlin.js 1.3 Mo reduced to its max?
k
What do you mean?
g
If I have a simple module calling only println(“Hello world”), I want to have a really really small kotlin.js file.
k
You'll get about 90kb of kotlin.js file in case of
println("Hello, world")
And about 45 kb after uglifying
g
Pretty good!!
Waiting for it to do some tests on my library 😉
k
If you don't mind of sitting on the bleeding edge, you can try it right now, from teamcity artifacts
👍 2
g
Have you got an URL to point me in the right direction?
Unpack and find
bin/kotlin-dce-js
s
Pretty good figures yeah !
I guess that will allow me to migrate from TypeScript to Kotlin JS on https://github.com/mixitconf/mixit 🙂
👏 1
n
Which Kotlin JS version will have the significant performance improvements?
b
@napperley which kind of performance do you mean? Compilation time or performance of generated code?
n
Meant the size of the transpiled JS files (generated code). Are there any rough numbers on compile time performance (eg sec to transpile, sec to generate doc)?
k
@napperley please, show example of code that causes Kotlin compiler to produce too large JS, we can discuss it. As for compilation time, there are no plans to improve compilation time in the near future. Instead, we are going to introduce incremental compilation for JS. This will allow to quickly recompile project when you make small changes to the code.
n
Will see what the size of the generated JS files is like after Kotlin JS 1.1.4 is released. Under the assumption that the generated JS files are significantly smaller in the next release compared to the current one.