Open chaosprint opened 1 year ago
The UI needs some performance work; it's improving, but it could still be a while.
To get the maximum performance, make sure to build the runtime and the WASM in release mode - e.g. cargo cf run --release music_sequencer -- --release
or ambient run music_sequencer --release
.
The re-rendering of a subtree occurs when there's a change in that subtree; for the music sequencer, there's a change every 125ms, when the slider is dragged, or when a note is selected.
If you're curious, you can compile Ambient with --features profile
and then use puffin_viewer
to connect to the client; you can then see how much time is spent in recalculating the UI tree each time one of these updates takes place.
Currently,
music_sequencer
example is a little bit laggy. Are all Rects getting re-rendered every frame?Similarly, in
todo
example, if you type something in the texteditor and move the cursor, all the text all be rendered, which is unnecessary. If you look closely at theHello
in the web client (https://ambient-demo.netlify.app/), you will find the same issue.The source shows that two new Text areas are constantly created: https://github.com/AmbientRun/Ambient/blob/main/shared_crates/ui/src/editor/text_editor.rs#L173-L195