GNOME Bugzilla – Bug 106892
pango_x_render performance
Last modified: 2007-06-20 18:16:37 UTC
pango_x_render draws by calling the X layer one character at a time. That hurts a bit, probably especially for remote connections. Patch coming up.
Created attachment 14562 [details] [review] Draw multiple characters at a time.
Maybe I'm missing something here, but where does the patch handle the case where the character's aren't positioned as XDrawString16() would position them?
Fails miserably? Does that happen? If so, can it easily be checked for?
Depends on the module, but most of them (including the "basic" shaper) will position characters such as accents at position other than the "natural" one at least sometimes. The character-by-character positioning did have a point other than just slowing rendering down :-) It shouldn't be hard to use XTextWidth() to coellesce runs of characters positioned naturally. Since I consider the X font backend more or less dead at this point, I've never bothered to go back and try and to improve things. (it didn't seem to be a huge bottleneck when I did care about that backend.)
Created attachment 14578 [details] [review] Revised patch
Ok, how about that one? Re pangox: I don't think you can expect it to go away for a few more years. The xft backend is insanely slow (10 times worse than pangox) without XRENDER on the display. (I have no idea how it fares with XRENDER.) If my googling is right, Sun only added XRENDER in December 2002. It'll be years before it hits production machines.
Created attachment 14701 [details] [review] Rerevised patch
This patch saves a few percent in cpu and probably a whole lot more in X traffic. I don't believe there is anything controversial here.
Created attachment 16883 [details] [review] Patch as applied
I applied a slightly-toned down version that always calls XTextWidth16 instead of trying to optimize that out ... less code to worry about bugs in, and XTextWidth16() isn't slow. Tue May 27 16:06:34 2003 Owen Taylor <otaylor@redhat.com> * pango/pangox.c (pango_x_render): Patch from Morten Welinder to collect characters into runs of the same font with natural offsets before drawing them. (#106892, Morten Welinder)