Howdy!
Just saw that text in my JUCE 8 app was taking a longer amount of time than I expected in performance traces. Rendering one 6 digit string like “0.8787” was taking 0.5ms to render in Debug and a couple hundred µs in Release, which seemed like a lot.
I did a quick comparison of JUCE 7/8 via perfetto with an empty project, default fonts, with this in the editor’s paint call:
auto text = juce::String (juce::Random::getSystemRandom().nextFloat(), 4);
TRACE_EVENT_BEGIN ("component", "g.drawText");
g.drawText (text, getLocalBounds(), juce::Justification::centred);
TRACE_EVENT_END ("component");
JUCE 8 develop rendering is ~3x slower in Release on my mac M1 (averages: 48µs JUCE 7.0.12, 149µs JUCE 8).
When the text is fixed (but the bounds change, for example due to resizing):
g.drawText ("0.8787", getLocalBounds(), juce::Justification::centred);
Averages for static text saw JUCE 7.0.12 as ~4x faster (33µs vs. JUCE 8 at 133µs), but with more variability?
Perhaps this is a reasonable price paid for improved font handling cross-platform. But thought I would drop the findings here in case there’s some more caching or optimizing that can happen, especially for static text.