bulia byak
2007-02-17 02:51:25 UTC
I was curious if cairo is in fact slower or faster than our current
renderer. I didn't feel like converting us totally to cairo yet, but
we have outline mode which is much simpler and perfect for tests like
this. So in about 3 hours (of which 2 hours were spent figuring out a
known bug in cairo) I converted our outline mode rendering to cairo.
The result of this experiment, after I adjusted the tolerance of cairo
to match our outline mode quality, is near parity. That is, cairo is
about as fast as our own renderer, at least for outline mode (i.e.
lots of paths but no gradients or transparency). However this claim
needs to be qualified:
- It is only true for the latest version of cairo (tested with
1.3.14). Versions 1.2.x are noticeably slower.
- This uses image backend to render to a memory buffer, and therefore
cannot use any hardware acceleration. Using hardware-accelerated
backends will require much more drastic changes in Inkscape's
architecture.
- Even with image backend, currently cairo is used _only_ for path
rendering, each path going to its own temp buffer, and these buffers
are later composed together just as they were before. I suspect that
if this is optimized by allowing a single cairo context draw all of
the paths in the drawing into a single buffer, performance will
improve noticeably.
In any case, since this does not make for any speed regression, and
since it fixes at least one bug that our native renderer had in
outline mode, I committed this. Please test outline mode thoroughly
and report if you find any problems. If everything works fine I'll
remove the old outline mode code and will look into doing some further
optimizations.
renderer. I didn't feel like converting us totally to cairo yet, but
we have outline mode which is much simpler and perfect for tests like
this. So in about 3 hours (of which 2 hours were spent figuring out a
known bug in cairo) I converted our outline mode rendering to cairo.
The result of this experiment, after I adjusted the tolerance of cairo
to match our outline mode quality, is near parity. That is, cairo is
about as fast as our own renderer, at least for outline mode (i.e.
lots of paths but no gradients or transparency). However this claim
needs to be qualified:
- It is only true for the latest version of cairo (tested with
1.3.14). Versions 1.2.x are noticeably slower.
- This uses image backend to render to a memory buffer, and therefore
cannot use any hardware acceleration. Using hardware-accelerated
backends will require much more drastic changes in Inkscape's
architecture.
- Even with image backend, currently cairo is used _only_ for path
rendering, each path going to its own temp buffer, and these buffers
are later composed together just as they were before. I suspect that
if this is optimized by allowing a single cairo context draw all of
the paths in the drawing into a single buffer, performance will
improve noticeably.
In any case, since this does not make for any speed regression, and
since it fixes at least one bug that our native renderer had in
outline mode, I committed this. Please test outline mode thoroughly
and report if you find any problems. If everything works fine I'll
remove the old outline mode code and will look into doing some further
optimizations.
--
bulia byak
Inkscape. Draw Freely.
http://www.inkscape.org
bulia byak
Inkscape. Draw Freely.
http://www.inkscape.org