Commit e861c8e
authored
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md)
before opening a Pull Request!
* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.
Please be patient! I will review your PR, but my time is limited!
-->
Moves `ends_with_newline` into `PlacedRow` to avoid clones during
layout.
I don't think there was a rationale stronger than "don't change too
much" for not doing this in #5411, so
I should've just done this from the start.
This was a significant part of the profile for text layout (as it cloned
almost every `Row`, even though it only needed to change a single
boolean).
Before:
<img width="757" height="250" alt="image"
src="https://github.com/user-attachments/assets/d1c2afd1-f1ec-4cf5-9d05-f5a5a78052df"
/>
After:
<img width="615" height="249" alt="image"
src="https://github.com/user-attachments/assets/c70966da-c892-4e84-adba-494d0f37f263"
/>
(note that these profiles focus solely on the top-level
`Galley::layout_inline` subtree, also don't compare sample count as the
duration of these tests was completely arbitrary)
egui_demo_lib `*text_layout*` benches:
<img width="791" height="461" alt="image"
src="https://github.com/user-attachments/assets/4f97ce84-2768-4876-9488-d42f8f358ed1"
/>
* [X] I have followed the instructions in the PR template
(As usual, the tests fail for me even on master but the failures on
master and with these changes seem the same :))
1 parent 2669344 commit e861c8e
File tree
4 files changed
+35
-29
lines changed- crates
- egui/src/text_selection
- epaint/src
- shapes
- text
4 files changed
+35
-29
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
44 | | - | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
141 | 146 | | |
142 | 147 | | |
143 | 148 | | |
144 | 149 | | |
145 | 150 | | |
146 | 151 | | |
147 | 152 | | |
148 | | - | |
149 | 153 | | |
150 | 154 | | |
151 | 155 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
299 | | - | |
300 | 299 | | |
| 300 | + | |
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
| |||
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
313 | | - | |
314 | 313 | | |
| 314 | + | |
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
319 | | - | |
320 | | - | |
| 319 | + | |
321 | 320 | | |
322 | 321 | | |
323 | 322 | | |
| |||
363 | 362 | | |
364 | 363 | | |
365 | 364 | | |
366 | | - | |
367 | 365 | | |
| 366 | + | |
368 | 367 | | |
369 | 368 | | |
370 | 369 | | |
| |||
389 | 388 | | |
390 | 389 | | |
391 | 390 | | |
392 | | - | |
393 | 391 | | |
| 392 | + | |
394 | 393 | | |
395 | 394 | | |
396 | 395 | | |
| |||
431 | 430 | | |
432 | 431 | | |
433 | 432 | | |
434 | | - | |
435 | 433 | | |
| 434 | + | |
436 | 435 | | |
437 | 436 | | |
438 | 437 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
572 | 572 | | |
573 | 573 | | |
574 | 574 | | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
575 | 582 | | |
576 | 583 | | |
577 | 584 | | |
| |||
617 | 624 | | |
618 | 625 | | |
619 | 626 | | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
625 | | - | |
626 | | - | |
627 | 627 | | |
628 | 628 | | |
629 | 629 | | |
| |||
735 | 735 | | |
736 | 736 | | |
737 | 737 | | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
743 | | - | |
744 | 738 | | |
745 | 739 | | |
746 | 740 | | |
| |||
776 | 770 | | |
777 | 771 | | |
778 | 772 | | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
779 | 779 | | |
780 | 780 | | |
781 | 781 | | |
| |||
867 | 867 | | |
868 | 868 | | |
869 | 869 | | |
870 | | - | |
| 870 | + | |
871 | 871 | | |
872 | | - | |
873 | | - | |
874 | | - | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
875 | 878 | | |
876 | | - | |
877 | 879 | | |
878 | 880 | | |
879 | 881 | | |
| |||
0 commit comments