https://kotlinlang.org logo
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
benchmarks
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
confetti
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
lincheck
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by
Title
b

bashor

07/06/2020, 3:38 PM
Hi, everybody! I just wanted to clarify the current situation of supporting WebAssembly in Kotlin. We are working on a dedicated Kotlin to WebAssembly compiler backend. So all works on wasm support in Kotlin/Native (through LLVM) were suspended. For the new compiler backend, we have set the following goals:produce small binaries -- to achieve it we decided don’t use own memory manager and use builtin one instead (see GC proposal); • fast compilation while developing -- for that we are going to be able to generate binaries directly; • better integration with hosts, especially with their GC to avoid leaks. Besides GC proposal we also depend on some other proposals that aren’t finalized yet. It’s hard to predict when all of them will be finalized and implemented. We have joined WebAssembly community group to work on proposals along with other stakeholders. Also, we are collaborating with some of Wasm VM vendors to get things done as early as possible and with our interests in mind. As well as other kotlin compiler backends it’s developed inside a public repository, so actual sources could be found here. We’ll try to keep you up to date, stay tuned!
🎉 8
👍 4
❤️ 30
:kotlin: 14
r

Robert Jaros

07/06/2020, 4:03 PM
Any very approximate ETA on new backend?
s

Svyatoslav Kuzmich [JB]

07/06/2020, 4:55 PM
We don’t have an ETA. As Zalim mentioned, it depends on quite a lot of external factors, and those are hard to estimate.
r

Robert Jaros

07/06/2020, 6:08 PM
But perhaps months, years or decades ? :-)
b

Big Chungus

07/06/2020, 6:36 PM
@Robert Jaros expect decades and be happily surprised when it comes any earlier 😄
😀 3
s

sdeleuze

07/06/2020, 6:37 PM
@bashor That’s great news thanks for sharing !
b

bashor

07/06/2020, 9:40 PM
@Robert Jaros someday, after GC proposal is ready 😉
s

sdeleuze

07/07/2020, 2:29 PM
What is the current status of the GC proposal ? Any stakeholders in addition to you?
s

Svyatoslav Kuzmich [JB]

07/07/2020, 2:32 PM
There are 2.5 competing GC proposals. Browsers started to implement one of them, but discussion is still ongoing. First V8 prototype is almost ready, but it will be under a flag until things are sorted out.
s

sdeleuze

07/07/2020, 2:33 PM
Ok thanks for your feedback it seems good progresses even if still frustrating to not see the GC support moving faster.
z

Zach Klippenstein (he/him) [MOD]

07/07/2020, 8:51 PM
Is this backend being built on top of the new kotlin IR?
b

bashor

07/07/2020, 10:44 PM
@Zach Klippenstein (he/him) [MOD] yes
🎉 3
j

Jilles van Gurp

07/08/2020, 6:39 AM
Awsome. I'm curious about the long term strategy for this. Particularly interesting would be the integration into the js eco system & of course kotlin js in terms of tools, multi platform builds, etc. Ultimately, there should be little advantage in using the js transpiler over the wasm compiler. The comments regarding GC are interesting, I think that was a reason that wasm is so far mainly used with languages that don't need that. C# blazor seems to be an exception but comes with relatively large binary sizes because they probably bundle one.
c

corneil

07/09/2020, 6:25 AM
I believe this is going to be a game changer! I can see it in desktop, mobile, embedded and small server environments. It will be Kotlin vs Rust in this space.
👍 1
1
s

sdeleuze

07/09/2020, 6:26 AM
Yeah but different target since Rust targets non GC variant and is more a low level language.
But they could be complementary
c

corneil

07/09/2020, 6:27 AM
Exactly. It will depend on how quickly you want to develop or what your constraints are.
d

darkmoon_uk

07/21/2020, 8:19 AM
@Jilles van Gurp You mis-spelled elimination of the JS ecosystem 👌
❤️ 1
(Honestly, it can't come quickly enough)
j

Jilles van Gurp

07/21/2020, 8:35 AM
@darkmoon_uk, I need type safe languages to save me from typos.
1
👍 1
n

napperley

07/25/2020, 10:56 PM
Would be curious to know what type of GC Kotlin WASM will be using.
e

elizarov

07/26/2020, 6:50 AM
It will be using WASM GC. The same GC that is already implemented by the corresponding execution engine (e. g. Orinoco in a modern V8).
👌 1
👍 2
b

Big Chungus

07/28/2020, 11:05 AM
@bashor, from your point of view (being much more involved with wasm proposals), when would you expect to have gc ready? This year, next year, next decade? Looking for a very rough ETA
b

bashor

07/29/2020, 4:58 PM
I hope during the next few months we will get some prototype under a flag (turned off by default) inside V8 (Chrome's engine), and I hope we will get the same inside SpiderMonlkey (Firefox's engine) at least next year. Since they would be early prototypes I can't even be sure that they will be available in release versions of browsers, even under a flag. It's really hard to say right now when it will be production-ready and importantly when it will be widespread. I think it will take years, but (hope) not a decade.
👍 5
r

Robert Jaros

07/29/2020, 10:20 PM
It took ~3 years to create wasm itself. "Just" adding gc should not be more difficult 😉
j

Jorrit

07/30/2020, 12:01 PM
Don't get me wrong, I'm excited about the development. But if I read this correctly, using Kotlin for WASM is pretty much a no-go right now with the LLVM version deprecated and the current work several years out. Unfortunate. I have no idea about which other proposals you're waiting for, but is there any chance for a transitional memory manager to hold us over until the host GC is widespread?
j

Jilles van Gurp

07/30/2020, 12:06 PM
@Jorrit I think both v8 (chrome & node.js) and the firefox implementation are moving pretty rapidly. Probably if Jetbrains were doing this a few years ago (like the blazor guys) it would have made sense to invest in custom memory management & GC. But as things are evolving building on what ships with standard implementations is the best use of time. It will in any case take time for tools and libraries to come together as well. I'm guessing Jetbrains is targeting the 1.5 release with a release version of this.
r

Robert Jaros

07/30/2020, 1:08 PM
Anyone has any experience with alternative solutions for Kotlin and Wasm? E.g. like java bytecode compilers (JWebAssembly, TeaVM)?
b

bashor

07/30/2020, 1:09 PM
@Jorrit could you please share more about your usecase? Why it’s critical to use wasm for it?
IMO, the current state of wasm is not suitable yet for developing real/production web application, since calls to and from wasm are expensive. The main use cases for wasm today are reuse code written in C/C++ and number crunching.
☝️ 1
b

Big Chungus

07/30/2020, 1:14 PM
I can second that. I've written VDOM KMP project that compiles from common sourceSet to both JS and WASM. And WASM performs SIGNIFICANTLY slower
Here's a compiled bundle of all three versions (js, wasm debug and wasm release) if anyone wants to see for themselves
b

bashor

07/30/2020, 1:17 PM
If you want to write a web application using Kotlin today we recommend you Kotlin/JS in the future we are going doing our best to make migration/interop between Kotlin/JS and Kotlin/Wasm smooth.
👍 1
r

Robert Jaros

07/30/2020, 1:19 PM
But products like Blazor WebAssembly gain a lot of attention right now. They will be years ahead of Kotlin if we will just sit and wait for next years 😿
1
b

bashor

07/30/2020, 1:20 PM
AFAIK Blazor is far from production-ready in terms of size and speed.
b

Big Chungus

07/30/2020, 1:22 PM
Guys, let's not kid ourselves. WASM will not be a valid alternative to JS for web UIs until direct access to DOM apis is implemented. Until then it's just a utility tool to import c libt to web and speed up heavy load processing operations.
3
j

Jorrit

07/30/2020, 1:24 PM
Performance for number crunching. But it's not critical at this point, just looking around for what the end-product could look like one day (if ever) and what the right tool for the job is. Kotlin is nice to target JS now and when the time comes 'upgrade' to WASM, but if that's 5 years out there's no sense even worrying about it. Somewhat off-topic, for Kotlin/JS I wonder if this - https://discuss.kotlinlang.org/t/kotlin-js-performance/10643 - is still a relevant issue, though?
🤔 1
r

Robert Jaros

07/30/2020, 1:26 PM
It's not about using it in production. It's about learning, playing and developing new solutions. And it's hard to do it, when the only tools available are deprecated and new will be available in a few years.
✔️ 1
b

bashor

07/30/2020, 1:45 PM
We don’t wait, we are working on Kotlin for Web, today it’s Kotlin/JVM on server-side and Kotlin/JS on client-side. Also, we are working on Kotlin/Wasm, collaborate with Wasm VM vendors to bring the future closer.
👍 1
The migration to other Kotlin targets will be as smooth as much of code will be written in pure Kotlin. And for that, as The Community, we need cover more and more cases in pure Kotlin.
👍 4
Please note, we are not waiting until the technology (Wasm, GC, fast interop, etc.) will be production-ready. We are working with VM vendors on prototypes on both sides, and anyone will be able to play with them much earlier, not in a few years.
b

Big Chungus

07/30/2020, 4:38 PM
To further emphasise how unperformant WASM to JS calls are, I've ran performance test on the same application (but WASM and JS variants) compiled from the same kotlin file for the same ammount of time and here's how they compare in terms of time spent scripting: • JS variant: 2901 ms • WASM variant: 4316 ms
:tnx: 1
n

napperley

07/30/2020, 10:01 PM
Some people have mentioned using WASM for Serverless, and Edge IoT, however that is best left to Kotlin/Native where those software development areas are already covered through the Linux targets, and the Linux integration that is required is already there.
1
j

Jilles van Gurp

07/31/2020, 12:22 PM
@napperley for most edge computing setups, wasm is the only thing that is going to be able to run there. Kotlin native is pretty much where wasm support will be as it is basically is going to leverage llvm.
b

Big Chungus

08/02/2020, 8:49 AM
To follow up with my previous WASM vs JS findings, it's nice to notice that WASM release bundle is MUUUCH smaller than JS: • JS: 2.49 MB • WASM: 424 KB Even WASM debug bundle is just 2.85 MB, not that much larger than JS release bundle
1
b

bashor

08/02/2020, 12:31 PM
@Big Chungus could you please provide more info about your measurements? What kind of operations do they perform? How did you measure the size? Is it size on disk? If so, maybe you took into account unnecessary files like .map? Have you tried the new JS compiler backend? What libraries you have as dependencies? Maybe you could share sources?
b

Big Chungus

08/02/2020, 12:33 PM
Sure, will compile all that a bit later today
:tnx: 1
👍 1
Ok, looks like previous size measurements were a bit off, here's the update (and bundles attached): • JS-Legacy: 226KB • JS-IR: 122KB • WASM Debug: 3MB • WASM Release: 436KB The sample project uses kvdom and forked kotlinx-html libraries and renders a simple vDOM-based app. All source code is in common code, that's compiled to both, JS and WASM. For performance test mentioned earlier I just ran "Surprise me!" button (that starts rendering random count between 100 & 1000 of elements each render cycle) for 10s on chrome dev-tools on linux machine. Full source code is available here . Hope that helps.
b

bashor

08/02/2020, 2:20 PM
@Big Chungus thanks for the update