[cairo] Text performance on windows?
Vladimir Vukicevic
vladimir at pobox.com
Wed Sep 10 18:23:46 PDT 2008
On Sep 10, 2008, at 5:52 PM, Damian Frank wrote:
> On Tue, Sep 9, 2008 at 2:39 AM, Vladimir Vukicevic
> <vladimir at pobox.com> wrote:
>> Is the code for this something that you can share? (I can write my
>> own, but
>> want to avoid redoing the work if at all possible.) I'm guessing
>> it does
>> something like:
>>
>> do_cairo_setup();
>>
>> for (int i = 0; i < bignum; i++) {
>> cairo_show_glyphs (cr, glyphs, nglyphs);
>> }
>>
>> And times the loop? (Want to make sure that you're not using
>> show_text or
>> similar.) And for the pure GDI case, you're just calling
>> ExtTextOutW,
>> ideally with ETO_GLYPH_INDEX?
>
> Unfortunately I can't share, both because of licensing and because of
> the excessive complexity of the software. However, it essentially
> does that, except it's time-based. The other important difference is
> that we *are* using show_text for testing purposes. Here are some of
> the timings breaking the overhead down a little bit. cairo_show_text
> represents time spent in the whole routine, and c_gs_* breaks it down
> into those two routines alone.
Yep, no worries, just wanted to make sure we'd be testing the same
thing. cairo_show_text is part of the "toy" text api, and is really
just there for prototyping and testing; it's not really a production-
quality API. So as your timings show, it looks like on average half
of the time is spent inside text_to_glyphs, which should go away if
you use show_glyphs directly. The perf with a dib32 and an image
surface looks to be the close, so I'm guessing we're taking a fallback
path there -- I'll definitely take a look there, as we may be able to
avoid that. I'm surprised by DDBs being slower than DIB24, though.
> As for our GDI comparison, yes, we have a text layout engine of our
> own and we do the rendering with ETO_GLYPH_INDEX.
Ok; I would suggest keeping that piece and just handing the glyphs to
cairo render via show_glyphs -- you won't be able to replace your
entire layout engine with cairo.
I'll try to create a small testcase for this in the next few days and
send it to the list and we can compare numbers.
- Vlad
>
>
> Some timings using QueryPerformanceCounter:
> ddb:
> ExtTextOutW: last: 8 avg: 8.5 min: 6 max:
> 2163
> cairo_show_text: last: 969 avg: 1012.6 min: 833 max:
> 86489
> c_gs_text_to_glyphs: last: 404 avg: 431.7 min: 385 max:
> 85762
> c_gs_show_tx_glyphs: last: 540 avg: 555.0 min: 420 max:
> 58285
>
> dib24:
> ExtTextOutW: last: 222 avg: 247.7 min: 198 max:
> 15359
> cairo_show_text: last: 737 avg: 786.3 min: 709 max:
> 15064
> c_gs_text_to_glyphs: last: 394 avg: 427.7 min: 384 max:
> 11327
> c_gs_show_tx_glyphs: last: 314 avg: 332.8 min: 297 max:
> 9396
>
> dib32:
> cairo_show_text: last: 1203 avg: 1294.8 min: 1167 max:
> 9301
> c_gs_text_to_glyphs: last: 397 avg: 430.3 min: 384 max:
> 5215
> c_gs_show_tx_glyphs: last: 782 avg: 839.5 min: 754 max:
> 7481
>
> image:
> cairo_show_text: last: 1073 avg: 1145.6 min: 1051 max:
> 51262
> c_gs_text_to_glyphs: last: 387 avg: 406.0 min: 383 max:
> 3776
> c_gs_show_tx_glyphs: last: 662 avg: 715.1 min: 640 max:
> 50815
>
>
> Thanks for your help. If you have any trouble reproducing the
> performance, I'm willing to try to reproduce what we do in a simpler C
> program.
>
> Damian
More information about the cairo
mailing list