mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-01 12:07:31 +01:00
MeasureString was slow mostly because of wrapping: DrawStringRect and MeasureStringRect re-ran the word wrapper every frame, and it measures every prefix of every word. Wrapped strings are now cached. The caches are unordered_maps with an xxhash of the key, and lookups reuse a key buffer so a hit doesn't allocate. UIContext also skips switching fonts when measuring in the current style. In a Mac debug build, 200 cached measures go from 0.26 to 0.06 ms and 10 wrapped paragraphs from 2.1 to 0.01 ms per frame. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>