[cairo] Cairo 1.9.2 performance

Benjamin Reed rangerrick at gmail.com
Thu Jun 18 18:16:54 PDT 2009

On Thu, Jun 18, 2009 at 2:17 PM, James Cloos<cloos at jhcloos.com> wrote:

> As a side note, since you are on osx, it would be interesting to
> see how compiling with llvm compares.

So on a whim, I thought I'd try compiling with various levels of
optimization in the different compilers provided by apple.

Versions are:

i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)
i686-apple-darwin9-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5566)
i686-apple-darwin9-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build
5555) (LLVM build 2056)

I built pixman and cairo from master git as of a couple of hours ago.
The MMX and SSE2 bits of pixman would not compile with llvm and CFLAGS
> -Os (ie, -O2 and -O3) with errors like:

../../pixman/pixman-mmx.c:2970: warning:
'fbCompositeOver_x888x8x8888mmx' defined but not used
Cannot yet select: 0xddf5c4: v2i32 = X86ISD::VZEXT_MOVL 0x410846f4
../../pixman/pixman-mmx.c:3209: internal compiler error: Abort trap


Cannot yet select: 0x1c07144: v2i32 = X86ISD::VZEXT_MOVL 0x4108afe4
../../pixman/pixman-sse2.c:5113: internal compiler error: Abort trap

Everything else built out of the box.

I then checked out the cairo-benchmarks and built with each of the
various options.  All tests ran, except for all of the text ones
(crashed in cairo-quartz).
The crashes were generally something along the lines of:

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000024
Crashed Thread:  0

Thread 0 Crashed:
0   libcairo.2.dylib              	0x0028a88d _cairo_quartz_ucs4_to_index + 45
1   libcairo.2.dylib              	0x002594e2
cairo_scaled_font_text_to_glyphs + 1762
2   libcairo.2.dylib              	0x00239cfa _cairo_gstate_text_to_glyphs + 106
3   libcairo.2.dylib              	0x00232775 cairo_text_extents + 325
4   texturedtext                  	0x00001d65 test + 373
5   texturedtext                  	0x00001ea3 main + 99
6   texturedtext                  	0x00001926 start + 54

I've put all the raw results (well, almost raw, I averaged the times
of each of the tests) up here:


And, an excel version with a nice total run time and locked left-hand column:


I'm surprised to say pure gcc-4.2 with "-O3" won the most number of
benchmark tests (27), followed by llvm-gcc-4.2 using "-Os" (12) and
gcc-4.2 "-O2" (11).

Not sure what conclusions to draw, other than in all but a few tests,
you're way better off at the very least using any form of gcc-4.2 that
comes with the newer XCode versions than the default 4.0.  But I think
that much would at least be obvious.  :)

Benjamin Reed a.k.a. Ranger Rick
Fink, KDE, and Mac OS X development

Blog: http://www.raccoonfink.com/
Music: http://music.raccoonfink.com/

More information about the cairo mailing list