Open DavidVonDerau opened 1 year ago
You are not mistaken. However, iirc my previous testing I would predict it not significant to the overall performance of drawing text (text layout, glyph rasterization, vertex generation & caching all being relatively much more expensive).
With that said if such changes would positively impact the benchmarks, or some new meaningful benchmark, it would be interesting and could point the way to better designs.
The other issue is changing away from Vec in Section
would be breaking, something I'd probably avoid without big win.
You can run the existing benchmarks with, for example cargo bench --bench glyph_brush
The
glyph_brush
API takes aSection
to queue, but theSection
internally uses aVec
to hold text. If I have a bunch of fields to write to the screen in different locations and with different bounds, it seems like each distinct field will force an allocation of a Vec with a capacity of 1.I'm not sure if I'm using the API wrong, or if I've missed something.
If this is how the API works, would you be interested in a PR that changes
Section
to use asmallvec
or other optimization for the scenario when aSection
only hold a single string?