I notice Compose for Web API uses `inline` quite a...
# compose-web
d
I notice Compose for Web API uses
inline
quite a bit more than I'd expect. Is that to reduce the final javascript bundle size?
If this is to reduce the final binary size, then 1. If I'm writing a Compose for Web library, should I try to follow this pattern? 2. Is this a temporary limitation? Is tree shaking going to come for Kotlin/JS sooner or later?
b
If anything, inline bloats the bundle size. Main benefits of inline functions are runtime performance.
es6 support is on the roadmap, but suspended until IR backend is stable.
d
Are these premature optimizations then? I can't imagine setting css style properties are something that is happening in a tight loop or in large volume. Maybe concerns about startup time?
b
HOWEVER, using inline with unsafeCast saves bundle size as end result is pretty much 0 as opposed to creating an entire new function just to change compile-time type.
d
Ah ok so sometimes it does, gotcha
b
Kotlin.js has quite a few "special" functions in stdlib that are not real functions but rather hints for the compiler.
👍 1
d
Ok thanks, I see
I think in the cases I linked to above both ultimately delegate to unsafe cast so it's probably that happening here
Thanks for the info!
b
I'm sure JB guys didn't just do things randomly 😀
d
Me too, but I didn't understand why and wasn't sure if or when I should be imitating it
🤝 3