Add caching of text labels at the UTF8 level
Previously, CGUITextLayout::Update converted its string argument from UTF8 to
UTF16, then passed it to CGUITextLayout::UpdateW, where it was compared
against a cached copy of the string (in its UTF16 form). However, the
conversion itself was taking up a reasonable chunk of CPU time.
This patch adds a similar cache of the string in its UTF8 form to the Update
method, and splits the non-cache part of UpdateW into a separate function, so
we can bypass it the case where we've tested it against the UTF8 cache.
I have measured the effect while the Videos window of the default skin was
open (but idle) on a Raspberry Pi, and this reduced the CPU usage by 2.9%
from 39.1% to 36.2%:
Before After
Mean StdDev Mean StdDev Confidence Change
IdleCPU% 39.1 0.9 36.2 0.5 100.0% +8.1%