[cairo] Text performance on windows?

Damian Frank damian.frank at gmail.com
Tue Aug 26 09:19:10 PDT 2008


Yes, I do wonder if I'm falling off of the slow path.  Unfortunately the
whole rendering system is a bit .. sprawling, and impractical to show
everything.  I'll try to show the relevant calls though.

For clipping, we are using cairo_rectangle/cairo_clip, with aligned
coordinates (although I need to verify that the alignment is working, I
suppose).  When rendering the text, here's what the code looks like:

    cairo_set_operator cr, CAIRO_OPERATOR_OVER);
    cairo_set_source_rgba(cr, red, green, blue, alpha);

    pixel_align_for_fill(cr, &x, &y);
    cairo_set_font_size(cr, font_size_pixels);
    maybe_throw_cairo_error(cr, "cairo_set_font_size");

    cairo_move_to(cr, x, y);
    cairo_show_text(cr, str_as_utf8);

For my testing, I haven't set any other text properties, so it's the default
font face & options.  Alignment is handled by transforming to device,
rounding to integral values, and transforming back to user space.

(I wouldn't be surprised if my method of getting the results on-screen is
also a bottleneck, since the app is double-buffered and I haven't done any
performance testing of the copy yet.  But right now I'm measuring the text
rendering itself.)

I really hope there's something I can do, because Cairo is, in all other
respects, awesome.  It's the best 2D API I've ever used, easily.

Thanks for your time,

Damian


On Tue, Aug 26, 2008 at 5:23 AM, Gerdus van Zyl <gerdusvanzyl at gmail.com>wrote:

> Please see this discussing on the list:
>
> http://lists.cairographics.org/archives/cairo/2008-February/012982.html
>
> The reason I saw slow rendering was with the way I did double
> buffering and the type of surface I created. If you could show us your
> text rendering code it would be informative.
>
> ~Gerdus
>
> On Tue, Aug 26, 2008 at 11:40 AM, Nicholas Allen <allen at ableton.com>
> wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > I also experience serious performance problems with Cairo. I have only
> > run on Windows but it's performance is so bad as to make it completely
> > unusable for what we need. It's a shame because the API is really
> > clean and the output looks great. Hopefully, this will get fixed in
> > future releases...
> >
> > Nick
> >
> > Damian Frank wrote:
> >> I'm pretty new to Cairo, and I've been looking at using it for a
> >> codebase that currently uses, variously, Xlib, GDI, GDI+, and
> >> Quartz, among others.  Performance is one of my chief concerns,
> >> though.  At the moment I'm looking at text performance, and I have
> >> some serious concerns.  For now, I am just benchmarking on Windows,
> >>  and only for to-screen rendering (as opposed to printing or
> >> PS/PDF/etc).
> >>
> >> Can someone give me some pointers on staying on the fast code paths
> >>  for text rendering on win32?  My tests so far show image and DDB
> >> both taking about 15-20x as long as our GDI implementation, and
> >> 24-bit DIB taking about 5x as long.
> >>
> >> Thanks,
> >>
> >> Damian
> >>
> >>
> >> ----------------------------------------------------------------------
> >>
> >>
> >> _______________________________________________ cairo mailing list
> >> cairo at cairographics.org
> >> http://lists.cairographics.org/mailman/listinfo/cairo
> >
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.7 (MingW32)
> > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> >
> > iD8DBQFIs8+jbpmWsXfOU58RAhUdAJ9ZvO339sJmJFpaIKaTLDbHEATLngCeK9zT
> > AoOUaWptYxAJZE5kIii1Whc=
> > =kDzx
> > -----END PGP SIGNATURE-----
> >
> > _______________________________________________
> > cairo mailing list
> > cairo at cairographics.org
> > http://lists.cairographics.org/mailman/listinfo/cairo
> >
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cairographics.org/archives/cairo/attachments/20080826/3957d0b9/attachment.html 


More information about the cairo mailing list