[cairo] WinXp benchmarks
Oleg Smolsky
oleg.smolsky at pacific-simulators.co.nz
Thu Mar 3 14:05:22 PST 2005
Hello Owen, thanks for an in-depth reply.
Owen Taylor wrote on Thursday, 3 March 2005:
>> It's easy to see that when the square edge grows linearly, both the
>> pixel count and rendering time grow exponentially.
> Do you mean quadratically? The timings above are actually going up
> *slower* than the pixel count.
Ummm... yeah, actually I did mean quadratically :)
>> So, how fast is cairo on other platforms?
> I have no real idea how complex your drawing is or how fast your
> machine is, but the general order of magnitude of performance sounds
> similar to what I'd expect.
As far as complexity of the scene goes, I make about 20 cairo_arc()
calls, 10 cairo_show_text() and several cairo_rectangle() per frame.
BTW, I am doing dual (or perhaps triple) buffering. Here is what I do:
- windows gives me a DC (realDc)
- create a compatible DC of the same size (myDc)
Now per frame:
- clear myDc
- render one full frame:
for_each (gauge)
- create a small tempDC
- cairo_create(); cairo_set_target_win32();
- render one gauge (a bunch of cairo_*() calls)
- BitBlt() tempDc into myDc at a specific point
- destryo cairo and tempDc
end for_each
- BitBlit myDc into the realDc
Now, those small tempDcs are created on the fly after Jost
Boekemeier's suggestion.... I used cairo_translate() and myDc before,
but I don't think this makes much difference - those dc-to-dc
BitBlt() calls are not the bottleneck here.
> On the Win32 side, one thing you can definitely try is to compare
> rendering to a DIB with rendering to a DDB/Window... if you are
> rendering mostly bezier paths, using a DIB will be a big
> performance win. On the other hand, if you are rendering mostly
> text, rendering to a DDB may be significantly faster.
Now, if I could clarify this a bit... Whenever I create a DC I do the
following:
m_dc = CreateCompatibleDC(dc);
m_bitmap = CreateCompatibleBitmap(dc, m_surfaceWidth, m_surfaceHeight);
m_oldBitmap = (HBITMAP)SelectObject(m_dc, m_bitmap);
that create a memory device context. Are you suggesting I call
CreateDIBitmap() and then attach it a memory DC?
Also, are GDI calls HW accelerated? And does cairo use these calls or
does it render every pixel using its own means? I wonder if it's
possible to push the current bottleneck into the hardware on win32?...
> Eventually, making the Win32 backend optionally work on top of
> Direct3D probably makes a lot of sense.
I guess this way cairo would be able to invoke higher level (yet HW
accelerated) functions to perform raster operations on a surface,
right?
Best regards,
Oleg.
More information about the cairo
mailing list