Closed fogti closed 5 years ago
(currently not fixed:) I experimented with the example code and (for me) the slowest operation was resizing. This should be fixable via delaying the window updates by a small time and only applying the last window size to prevent the creation+destruction of dozens of window surface instances.
it would be advisable to catch the Init
event and perform the first rendering before the first resize event comes in.
could it be possible to cache parts of the text rendering?
Well ideally the rendering would run in a different thread entirely, which would also solve the resizing problem. Though, we can definitely "rate-limit" the resizing somehow. Although it is peculiar you have such high CPU usage, I'm seeing a max CPU usage of 2% and ~5% GPU. Could you possibly profile the CPU calls?
As for text caching, Skia already caches a lot of the text rendering stack, either with a typeface store or with the OS glyph cache, and we're also already storing the result of the font match from font-kit
in the counter example.
Overall, I'll see what I can improve with the performance in the counter example.
The example code runs with 100% CPU load on one core. Trivial changes drop this to ~80%.