1

Thanks to the new Chrome experimental profiler, I'm getting some more information about a Canvas2D app I'm developing. The glyph cache memory usage is massive, as you can see below :

Chrome Profiler

I suspect that one of the reasons why it's doing that is that I'm drawing each character one by one along a path (because only Firefox currently supports text along a path). Thus each character is added into the glyph cache, making the memory usage ginormous and the rendering speeds slow as hell.

It is especially worrying in Android, where I'm working on limited resources. The app is essentially unusable unless I don't render any text that way.

This article suggests that using small offscreen canvases and drawImage calls improves performance a lot, but that was 2 years ago.

So, how does Chrome's glyph cache actually work? Does it cache each character, each word, each string passed to fillText? Does it cache only by character or by a tuple of (character, size)?

4

0 回答 0