You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The glyph_brush API takes a Section to queue, but the Section internally uses a Vec 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 a smallvec or other optimization for the scenario when a Section only hold a single string?
The text was updated successfully, but these errors were encountered:
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?The text was updated successfully, but these errors were encountered: