Hi all, I'm using Compose Web for a small project ...
# compose-web
p
Hi all, I'm using Compose Web for a small project and it's working well, except for the fact that it's extremely slow at rendering many elements; for example, a table with 300+ rows takes about 3 seconds, while the same with kotlinx.html takes a blink. Is this a limitation of the architecture or something that will be overcome? Or maybe I'm doing something wrong?! Thanks for any pointers
o
I think it’s still a tech preview. This is the latest blog post https://blog.jetbrains.com/kotlin/2021/05/technology-preview-jetpack-compose-for-web/
First, a small disclaimer: as a technology preview, Compose for Web is far from being done – we don’t yet provide learning materials, tutorials, or documentation, and we have not done any performance optimizations yet (so hold your benchmarks!). It is certainly not yet ready for use in any production application.
p
Thanks Omar, I understand it's a preview technology, I guess I just wanted to adjust my expectations for the platform for the forseable future 🙂
🙂 1
b
That's an old post, I think it's considered "Beta" now: https://blog.jetbrains.com/kotlin/2021/10/compose-multiplatform-goes-beta/
s
@paoloconte What version are you using? I’m curious if things are better if you use the latest beta version
p
Hi @spierce7 I'm using version 1.0.0-beta5 and I've seen no improvements in this regard compared to alpha
g
I have also observed slow rendering, with a mix of forms and tables, even with many less than 300 rows - like a few text fields and a table with ~10 rows and 50 cells total. I have been assuming it is because this is pre-release and not optimized, but also cannot rule out that I am doing something very inefficiently and don't know it. I have multiple forms the user can switch between, and the switching was slow. One of the optimizations I made was to always compose all the forms, but set the visibility to hidden on all but the selected one, rather than choosing to compose or not depending on the selection. This sped up the switching speed a bit, but feels like a hack.
g
Something like LazyColumn for compose for web should fix that
👍 1
t
I tried the render tables at once approach with React a few years ago and it was also really slow. Actually react documentation says that above 100 rows use virtualization.
p
@Goregius it's true that LazyColumn would solve the issue with large tables, but it feels like it's just hiding the problem, meaning that if performance is low then we would always be consuming more resources overall