Profiles indicate that for CJK languages, glyphs get scaled too frequently because the default cache is too small: http://www.gnome.org/~federico/news-2007-10.html#pango-cjk-1 cairo-scaled-font.c has this: #define MAX_GLYPHS_CACHED_PER_FONT 256 and it includes a comment that it would be better to have a cache shared across all fonts, with a random replacement policy. Simply increasing this value to 2048 gives very good results; with the pango-profile benchmark, scaling glyphs went from using about 60% of the time to only using about 13%. This bug is a reminder that a cache shared across shared fonts is desirable.
Federico, I expect that the profile is a bit artificial as no normal application needs so many unique characters at once... I'm fine with increasing current 256 to 512 or 1024 though. But lemme blog about how to make it not increase process size first... (may want to do something similar in pango caches too.)
Here's the secret: http://mces.blogspot.com/2007/10/episode-vi-return-of-federico.html Basically, if you make cairo-xlib-surface.c release glyph surfaces after uploading them to the X server, without hurting the case of image surface using them, you can increase the cache size without much affecting process size. A good enough scheme would be to release the surface if xlib-surface caused it to be created. But we don't have the means to find that out right now I guess.
(In reply to comment #1) > Federico, I expect that the profile is a bit artificial as no normal > application needs so many unique characters at once... View a CJK page in Firefox (say, the daily news). You'll get plenty of unique glyphs :) We could certainly patch Pango to build histogram of this for profiling purposes.
Can you give the enlarged cache size another try with my xlib patch?
Moved to a "global glyph cache" TODO.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.