Brush Performance

T Hall tahall256 at
Tue Feb 21 19:31:45 UTC 2012

Comparing basic brush (round, hard edge, smoothing turned OFF)
performance between krita and gimp (both from git), I notice gimp still
does some nonlinear interpolation (Catmull-Rom) via
gimp_motion_buffer_interpolate_stroke if events are few and far between
(very fast-moving pen, interpolation works by creating extra events.
Ultimately the brush interpolates linearly between these). Krita, in
contrast, simply interpolates linearly between the events received from
the tablet.

However, the striking thing, at least on my not particularly high-spec
computer, is the difference in performance while doing the same stroke
(tried using exactly the same input by recording and playing back X
events, brushes set to a close match):

 - Krita uses lots of CPU time and the stroke starts to lag behind the
   motion of the tablet.

 - Gimp, despite doing some more complex interpolation along the way,
   remains responsive, with lower CPU usage and no perceptible lag.

Note that while I was moving the pen rather fast when testing the two,
I find the effect is noticeable when painting at a reasonable speed
(Otherwise I wouldn't have started looking into it in the first place).
It is especially obvious after using one program for a while, then
switching to the other. The lag is also particularly noticeable for
smaller diameter brushes, presumably because for the same spacing,
krita's paintLine needs to call paintAt many more times to cover the
distance between events. (If gimp suffers a similar slowdown on small
diameter brushes, it is not enough to be perceptible to the user)

This leads me to wonder what krita is doing with all the extra CPU time.
The fact that gimp achieves an identical (well, better actually - it's
got some smoothing from the Catmull-Rom interpolation) result without
using as much CPU time suggests krita is either doing unnecessary
things while painting the stroke, or it's doing the necessary things
very inefficiently (which logically is the same thing, I suppose).

T Hall

More information about the kimageshop mailing list