How do I enable the new `experimental multithreade...
# compose
s
How do I enable the new `experimental multithreaded recomposition`(yes, I am aware of the problems)? Leland said on the stream that it is now possible and you can turn it on and play. I'm reading the source for the
CompositionContext
class, but I don't know how to use it. Can anyone please help? Thanks 🙂
d
On
Composition
or
Recomposer
there's a method called runConcurrent....something I think.
s
nothing there similar 😞
I definitely know Adam Powell worked on this, but I don't want to mention him for trifles. 😬
👀 1
Recomposer.runRecomposeConcurrentlyAndApplyChanges
is what it's called lol.
s
How should I use it?
I thought it would be something like a compiler flag
d
No idea. Maybe source code of
setContent
might have a hint.
a
1. make a Recomposer (probably with
AndroidUiDispatcher.Main
as its effect context) 2. get it running by calling the method described above, use
AndroidUiDispatcher.Main
for that call (edit: launch the call into
AndroidUiDispatcher.Main
and pass some background dispatcher like
Dispatchers.Default
or a background single-threaded dispatcher as the recompose context parameter) 3. create a ComposeView and set its parentCompositionContext to the Recomposer you created 4. Attach your ComposeView to a window
❤️ 1
🎉 3
you'll probably run into some bugs right away 🙂
k
🤣🤣🤣🤣🤣
2