The biggest problem today for Kotlin/JS is tooling.
Using ktor-js client, with really basic usage (GET, POST, …) and AFTER Kotlin DCE, I end with:
kotlinx-coroutines-core.js : 362 Ko
kotlinx-coroutines-io.js: 157 Ko
kotlinx-io.js: 223 Ko
kotlinx-serialization-kotlinx-serialization-runtime.js: 271 Ko
ktor-ktor-client-core.js: 292 Ko
ktor-ktor-http-cio.js 43 Ko
ktor-ktor-http.js: 168 Ko
ktor-ktor-utils.js: 80 Ko
Waaaay too much to be able to do this call:
Copy code
val response = <http://client.post|client.post><HttpResponse>("/account/profile") {
val jsonData = Json(JsonConfiguration.Stable).stringify(
ProfileFormState.serializer(),
store.state
)
body = jsonData
}
☝️ 1
💯 1
r
ribesg
10/24/2019, 2:51 PM
You probably mean the second biggest after the level of documentation 😛
☝️ 1
g
gaetan
10/24/2019, 2:51 PM
😅
gaetan
10/24/2019, 2:52 PM
I know the team is working on so many parts, but still, it’s frustrating.
a
altavir
10/24/2019, 8:25 PM
Webpack bundler is making a single bundle from all of it. Have you run it?
g
gaetan
10/24/2019, 8:41 PM
Yes, I also use webpack. But it doesn’t remove code. With the uglify plugin you gain a little bit of bandwidth but you still have unused code parsed by the browser. axios library is around 43Ko in clear code and 13Ko minified. Here, the import of ktor-http cost me more than 1Mo. Twenty five times more. It makes no sense and Kotlin/JS will never be accepted as a viable solution until this issue is fixed.
f
Fudge
10/24/2019, 11:44 PM
Dead code elimination tools can prove to be very limited, because one thing happens to eventually reference everything. For example if you use proguard with kotlin-reflect you get the full huge jar if you use one method.
g
gaetan
10/25/2019, 7:29 AM
For Kotlin Js DCE tools, the main problem is that it operates on an JS AST. The reachability of nodes is probably more difficult to estimate. At the end a lot of unused nodes is kept. Doing this analysis inside kotlin’s AST should provide a much more accurate analysis and better results.
gaetan
10/25/2019, 8:29 AM
I did some more tests on a new project with one single