After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 320665 - Use a cache to map gunichar->glyph_index in each PangoCairoFcFont
Use a cache to map gunichar->glyph_index in each PangoCairoFcFont
Status: RESOLVED FIXED
Product: pango
Classification: Platform
Component: general
1.10.x
Other All
: Normal normal
: ---
Assigned To: pango-maint
pango-maint
Depends on:
Blocks:
 
 
Reported: 2005-11-04 01:20 UTC by Federico Mena Quintero
Modified: 2005-11-04 23:14 UTC
See Also:
GNOME target: ---
GNOME version: 2.11/2.12


Attachments
fmq-gunichar-to-glyph-index.diff (4.89 KB, patch)
2005-11-04 01:21 UTC, Federico Mena Quintero
none Details | Review
Updated fmq-gunichar-to-glyph-index.diff (4.93 KB, patch)
2005-11-04 23:07 UTC, Federico Mena Quintero
none Details | Review

Description Federico Mena Quintero 2005-11-04 01:20:51 UTC
In Pango profiles, pango_cairo_fc_font_get_glyph() shows up pretty high in the
profile, at around 16% of the time spent in Pango.  An analysis of this is here:

http://primates.ximian.com/~federico/news-2005-10.html#gtkfilechooser-profile-5

With the attached patch, this gets reduced to 4% of the Pango time for most
languages.  

The patch implements a simple, fixed-size cache that maps gunichars to per-font
glyph indices.

I still need to see what happens for different cache sizes.
Comment 1 Federico Mena Quintero 2005-11-04 01:21:33 UTC
Created attachment 54299 [details] [review]
fmq-gunichar-to-glyph-index.diff
Comment 2 Federico Mena Quintero 2005-11-04 23:07:05 UTC
Created attachment 54329 [details] [review]
Updated fmq-gunichar-to-glyph-index.diff

This is a cleaned-up patch.  It now uses #defines instead of explicit numbers
for the cache size and the cache mask.	I'll commit this in a second.
Comment 3 Federico Mena Quintero 2005-11-04 23:14:54 UTC
OK, it's on CVS now in HEAD.

2005-11-04  Federico Mena Quintero  <federico@ximian.com>

	Fixes #320665:

	* pango/pangocairo-fcfont.c: Use a simple, fixed-size cache to map
	gunichars to glyph indices within the font.  The cache is
	described in detail here:
	http://primates.ximian.com/~federico/news-2005-10.html#gtkfilechooser-profile-5
	(GlyphCacheEntry): new structure to hold a gunichar and a PangoGlyph.
	(struct _PangoCairoFcFont): Add a char_to_glyph_cache field.
	(pango_cairo_fc_font_get_glyph): Allocate the char_to_glyph_cache
	if needed.  We do it on demand because while many fonts will be
	alive at any one time (in order to cover the whole Unicode space),
	only very few of them will be actually accessed for glyph lookups.
	(pango_cairo_fc_font_get_glyph): Look up the gunichar in the
	cache, and replace the cache entry if necessary.
	(pango_cairo_fc_font_finalize): Free the char_to_glyph_cache.