[cairo] Patches for speeding up _cairo_fixed_from_double

Sean Kelley sean.sweng at gmail.com
Wed Nov 8 19:03:10 PST 2006


On 11/2/06, Daniel Amelang <daniel.amelang at gmail.com> wrote:
> Attached are patches resulting from the discussion here:
>
> http://lists.freedesktop.org/archives/cairo/2006-October/008285.html


Xan ran this patch in comparison here.

http://blogs.gnome.org/view/xan/2006/11/06/0

It is an improvement, but I am still liking Matt Hoosier's pangoxft
patch to 2.10.

Sean

gtk2-6 is the heavily patched GTK+ 2.6 currently used in the Maemo
platform. It's here.
gtk2-10xft is stock GTK+ 2.10.6 with this patch applied. It basically
replaces pangocairo with pangoxft for text rendering. Everywhere else,
it still uses Cairo (1.2.4).
gtk2-10cairo is GTK+ 2.10.6 stock using Cairo 1.2.4.
gtk2-10cairopatch is the same as gtk2-10cairo but cairo has this patch
applied. It applies heavy wizardry (and I mean heavy) to optimize the
hell out the double to fixed conversion.
 It is a good improvement, but still not up to par with our pangxft
patch to 2.10.


>
> First one defines an autoconf macro AX_C_FLOAT_WORDS_BIGENDIAN that
> uses a similar technique as AC_C_BIGENDIAN to avoid having to actually
> run code to determine the endianness (thanks again to Owen for the
> tip).
>
> Then there's the new _cairo_fixed_from_double that uses
> FLOAT_WORDS_BIGENDIAN to pull off the magic number trick in a portable
> manner.
>
> Finally, I put together a new performance test to show off the new
> speedup. This was necessary as no current tests really exercise the
> API calls where conversion takes place. I don't really recommend that
> this make it into the main performance suite, as it's pretty specific
> to this particular case, but I'm including it here for posterity.
>
> Both the autoconf macro and _cairo_fixed_from_double code are perhaps
> overly documented, but they both use pretty unusual techniques, so I
> figured they could use the extra attention.
>
> Speedup (detailed diffs attached):
>
> On my Pentium M (1.8GHz) I saw 2.5-3x speeup on my new
> pattern_create_radial test. Several of the text_* tests saw a 1.2-1.4x
> speedup.
>
> On the same box, I changed over to use software floating point (long
> story, hollar if you want details) and also saw a ~3x speedup on the
> pattern_create_radial test (the actual magnitudes  were quite
> different, of course). Again, moderate speedups with the text tests,
> but here we see a 1.5x speedup on the tessellate tests (still using
> the old tessellator, though). Although the exact amount of speedup
> seen on the Nokia 770 will likely be different, I think it will be in
> the same ballpark. Anyone with one willing to test?
>
> On a side note, I tried inlining the function to see what would
> happen, and I got a 471x slowdown. Pretty bizarre; I'll have to look
> into that later.
>
> Dan Amelang
>
>
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://cairographics.org/cgi-bin/mailman/listinfo/cairo
>
>
>


More information about the cairo mailing list