[cairo] pycairo performance tips

Prashant Saxena animator333 at yahoo.com
Tue Aug 10 01:39:46 PDT 2010


Hi,

I am using cairo 1.8.6, wxpython 2.8.10.1 and python 2.6. I have created a 
custom OO based scene graph framework. I am using this frame work for a visual 
node based application. A similar screen shot can be found here:

http://www.chamberlinproductions.org/Files/Blender/Blender%202.48a%20Screenshot.jpg


From functionality point of view cairo is working great but from performance 
wise it's slightly lagging. Although I have implemented
a custom cache implementation to make it as fast as possible but still I need 
some tips to improve it.

Once a node is drawn it's cached as bitmap and instead of calling entire drawing 
operations, I am drawing it's bitmap. 



The main area where I need speed-ups are related to view port navigation:

1. When you select a node and move, you have to repeatedly call the main 'draw' 
to update the canvas and it's drawing all the nodes.

2. When you zoom-in or zoom-out (scaling DCs), you have to re-cache the node.

3. When you scroll/pan the canvas you have to draw all the nodes for every 
mouse-move call. This is much slower if you have already zoomed-in.(DC's scale 
is 5 or greater)

Overall, how do you take out most of cairo/pycairo when you are creating a 
frame-work similar to the screen shot above?

Shall I try newer version? (if there are any performance based improvements 
rather then functionality)

Cheers

Prashant





More information about the cairo mailing list