[cairo] Text performance on windows?

Owen Taylor otaylor at redhat.com
Tue Aug 26 12:28:29 PDT 2008


On Tue, 2008-08-26 at 12:38 -0500, Damian Frank wrote:
> By the way, I apologize for the email volume, but I wanted to attach
> my latest performance tests.  These are based on a quick and dirty
> "render as many glyphs as possible in one second" test, using the same
> string at the same position, run on a 2GHz Core 2 Duo.  gdi, d3d, and
> gdi+ refer to other back-ends we have already implemented, performing
> the same operations.  This benchmark should only include time spent
> rendering text, not swapping buffers or anything like that.
> 
> I find it quite interesting that dib is faster than ddb.  In
> particular, the ExtTextOutW call is tremendously slower, and yet the
> DDB case seems to incur much more overhead in
> cairo_gstate_show_text_glyps for the DDB case.  Is this to be
> expected?

No it's not expected. 

In general, rendering to DIB's is much faster with cairo, because 
software fallbacks are needed for diagonal lines, curves, many types
of alpha blending, etc, and fallbacks are slow on a DDB, but text should
be fast there.

(At least if it's fast for ExtTextOutW... ClearType may not be hardware
accelerated for all drivers.)

Check in a debugger that you have a direct code path:

 cairo_show_text() => 
    _cairo_gstate_show_text_glyphs() => 
    _cairo_win32_surface_show_glyphs() =>
    ExtTextOutW()

If you hit a fallback path instead, why it's hitting the fallback path (whether
it's a cairo bug or something you are doing) is why it is slow.

- Owen





More information about the cairo mailing list