[cairo] Optimizing the fetching calls

Antoine Azar cairo at antoineazar.com
Wed Apr 23 15:54:57 PDT 2008


While profiling a test app I did with Cairo (mostly scaled up/down and
rotated blitting), I noticed a LOT of time is spent fetching and storing
pixels in Pixman. I had a look and implemented a small optimization that
substantially reduces the number of fetching calls needed. This optimization
works well especially in the cases of scaled up blitting and bilinear
filtering, as we'll be often requesting the same pixels many times in a row.
There's no point in fetching them again.
In my test app, blitting an image 11 times ranging linearly between scales
of 1.0 to 3.0 (while rotating 10 degrees each time), this patch goes from
18.6 million calls of fbfetch down to 10 million.
 
I'm attaching here my patch, along with some benchmark results. The
performance gains go up to about 3X.
 
I'm still looking into further optimizing fetching/storing calls.
 
Best,
Antoine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cairographics.org/archives/cairo/attachments/20080423/5a8a981f/attachment-0001.htm 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cairographics.org/archives/cairo/attachments/20080423/5a8a981f/attachment-0002.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Optimization-to-reduce-fetching-calls-in-scaled-up-o.patch
Type: application/octet-stream
Size: 0 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20080423/5a8a981f/attachment-0001.obj 


More information about the cairo mailing list