-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cache for Skija fonts #144
Conversation
I can confirm that this removes the bottleneck. However I would propose to make the cache thread safe (e.g. use ConcurrendHashMap). |
24338cf
to
bd1e736
Compare
Good pointer. The PR was originally only intended for demonstration purposes but it seems to be almost usable as is. I accordingly adapted the map to be thread-safe. |
bd1e736
to
daa5927
Compare
@HeikoKlare, did you consider that this might become a memory leak, because the cache is never cleared? |
Yes, that might be a result if fonts are created for very many font data. However, I consider this (1) unlikely and (2) this cache is only necessary as long as we use a combination of native and Skia fonts (i.e., as long as we still use native widgets as default). Once we completely switch to Skia, the existing font caching mechanisms will directly be applied to Skia fonts instead of native fonts. That's why I think we could accept this potential leak for now, in particular since I think it would not be that easy to define a reasonable cleanup mechanism. |
The only straightforward mechanism I can think of is to use weak references, but since this issue will disappear after the complete switch, I agree that it's acceptable to tolerate the potential leak for now. |
daa5927
to
fda6dcc
Compare
No description provided.