[cairo] Cairo + GTK animation - high Xorg load

Stefan Salewski mail at ssalewski.de
Fri Oct 28 09:27:15 UTC 2016

On Thu, 2016-10-27 at 14:40 -0400, David J. Herzfeld wrote:
> Actually, it's only 1000 points on a single line, not 1000 lines. So, I 
> figures this is pretty simplistic, and should have a relatively low 
> load.

No, each call of cairo_line_to() draws a line segment from current
location to new location. And cairo tries to do that as smooth as
possible. The sine wave coordinates generally match in no way the
integer screen cordinates, which may make smooth drawing more
complicated, and for each segment many pixel are involved. So we draw
60000 line segments each second. Of course this is not much compared to
shapes that modern graphic cards can generate.

I have run your first example, and indeed X load increases when window
size is increased. That was my obserbation for my schematics editor as

Maybe upcomming wayland will impove the situation. I have done a short
google search again, but have not found new results concerning cairo.
There exists other libs which may be faster, for example skia. 

More information about the cairo mailing list