Gtk developments

Interesting developments in the Gtk world. First, Federico Mena-Quintero, superhero programmer from Novell (formerly Ximian), had started to profile to profile the performance of common Gtk+ widgets back in July, presumably in response to the collective wailing of thousands of OSNews readers about glacial Gtk+ performance. Eventually, he decided to focus on the filechooser dialog, and found that it was spending much of its time rendering text. In the Gtk world, rendering text is the job of Pango, an very complex library for correctly displaying text in pretty much any of the world’s alphabets or scripts (this is much more complicated than you might think because Pango has to obey the typographic conventions of languages as diverse as German, Arabic, and Thai). In any case, after months of work, there are results, committed to the Pango CVS. He added a cache (with a proper eviction policy!) for looking up glyphs in font files, which sped up font rendering by 12% (later tests showed that the cache was extremely effective for western languages, with less than 1% miss rate; Cyrillic languages had a miss rate of ~1.5%; the worst was Korean, with 18% miss rate — which is still bettter than without the cache). He addded a table associating each of the first 8192 unicode code points to its unicode script (e.g. “A” is a Latin letter, and “щ” is a Cyrillic); before, to accomplish this, Pango did a complicated binary search. That sped up all non-CJK rendering by 8% (Chinese, Japanese, and Korean characters are too numerous to put into such a table). He then used the same table to speed up searching for paired characters (e.g. ‘{’ and ‘}’, ‘«’ and ‘»’, etc). Finally, he replaced various string lookups with GQuark lookups (i.e. looking up strings via hashes). By that point, he had cut the running time of his test program by 24%, at least for Spanish. And since his patches were accepted into the Pango CVS, we may be seeing a much faster Gnome (and Firefox, and anything else that uses Gtk+) in a few months.

And a second development is that Mikael Hallendal and his company Immendio have started working on a native port of Gtk+ to OSX. Which is to say: Gtk+ widgets will be drawn using Quartz instead of Xlib, and Gtk+ windows will be standard OSX windows instead of X11. It is also likely that Gtk+ will be able to use standard Mac fonts, fixing the complaints that custom fonts on OSX do not (easily) integrate into Gtk+-via-X11 programs. However, the look-and-feel of these Quartz-drawn windows will be the standard Gtk+ — blocky, grey, and quite different from the rest of the OSX desktop. A custom theme will be required to get Gtk+ on OSX to look like Aqua (just like the Wimp theme is required to get Gtk+ on Windows to look like the rest of Windows). The work is a very raw beta at this point; e.g. a Gtk+-on-OSX Gimp compiles but is crashy.

Leave a Reply