![]() # Objective Fixes #16783 ## Solution Works around a `cosmic-text` bug or limitation by triggering a re-layout with the calculated width from the first layout run. See linked issue. Credit to @ickshonpe for the clever solution. ## Performance This has a significant performance impact only on unbounded text that are not `JustifyText::Left`, which is still a bit of a bummer because text2d performance in 0.15.1 is already not great. But this seems better than alignment not working. ||many_text2d nfc re|many_text2d nfc re center| |-|-|-| |unbounded-layout-no-fix|3.06|3.10| |unbounded-layout-fix|3.05 ⬜ -0.2%|2.71 🟥 -12.5%| ## Testing I added a centered text to the `text2d` example. `cargo run --example text2d` We should look at other text examples and stress tests. I haven't tested as thoroughly as I would like, so help testing that this doesn't break something in UI would be appreciated. |
||
---|---|---|
.. | ||
bevymark.rs | ||
many_animated_sprites.rs | ||
many_buttons.rs | ||
many_cameras_lights.rs | ||
many_components.rs | ||
many_cubes.rs | ||
many_foxes.rs | ||
many_gizmos.rs | ||
many_glyphs.rs | ||
many_lights.rs | ||
many_sprites.rs | ||
many_text2d.rs | ||
README.md | ||
text_pipeline.rs | ||
transform_hierarchy.rs | ||
warning_string.txt |
Stress tests
These examples are used to stress test Bevy's performance in various ways. These should be run with the "stress-test" profile to accurately represent performance in production, otherwise they will run in cargo's default "dev" profile which is very slow.
Example Command
cargo run --profile stress-test --example <EXAMPLE>