[maemo-developers] [maemo-developers] Cairo benchmarking

From: Kalle Vahlman kalle.vahlman at gmail.com
Date: Thu Oct 27 19:49:49 EEST 2005
Hola list!

I started to write a little Cairo animation to better introduce myself
to the wonders of it, and thought I'd do a little Cairo benchmarking
with it on the 770.

The setup:

Compiled cairo 1.0.2 with vanilla settings, and copied to the device.
Compiled my demo with -O3
The device was not the latest HW nor SW, so the results might be a tad
worse than they are on the current devices. Haven't rerun the
benchmark yet on newer devices.

The demo:

It consists of:
 - creating a XLib surface from the X window
 - creating image surface for background (only on startup)
 - copying from that to a buffer surface to clear bg when drawing
 - drawing a simple shape with lines and few bezier curves on the buffer surface
 - copying the drewn areas to the xlib surface

I don't know if this is the most efficient way to draw with cairo, I
might be doing something foolish here and slowing down the process
(please say that I do?-).

The results:

Not that convincing.

I ran the demo with 1, 5 and 10 objects drawn simultaniously, and the
FPS calculated from those are 5.71, 2.6 and 1.51.

So nowhere near "smooth" animation.

I tried to compile the cairo with the softfloat toolchain in
scratchbox but that made cairo refuse to draw anything (not sure what
goes wrong there), although it doesn't crash or complain.

The timings for the last three items in the above list tell that the
slowest parts are (not suprisingly) the item drawing (0.048s per item
consistently) and the transferring to the xlib surface (0.099s for 1
item, 0.115s for 10 items).

Intresting note is that the xlib surface transfer is apparently well
buffered, and does not grow linearily with the item count. Still the
initial hit is big enough.

This is of course presented in the context of animation, but I think
that if you can't do smooth animation (somewhere between 10-15FPS)
with simple objects, it won't be fast enough for UI either.

The biggest bottleneck seems to be indeed the object drawing (I'd
guess the beziers are to blame), but I intend to test drawing
different types of elements once I get the time, plus a better
profiling of what's taking so long and where.

The test results are attached, as well as the demo (the code is little
messy and contains excess stuff as it's been "evolving").

Kalle Vahlman, zuh at iki.fi
Powered by http://movial.fi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: leaf.c
Type: text/x-csrc
Size: 11266 bytes
Desc: not available
Url : http://lists.maemo.org/pipermail/maemo-developers/attachments/20051027/0cb15af2/attachment.c 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cairo-on-770.gnumeric
Type: application/x-gnumeric
Size: 22404 bytes
Desc: not available
Url : http://lists.maemo.org/pipermail/maemo-developers/attachments/20051027/0cb15af2/attachment.gnumeric 
More information about the maemo-developers mailing list