[patch] on the performance of KisCircleMaskGenerator::valueAt

Geoffry Song goffrie at gmail.com
Fri Dec 24 05:00:40 CET 2010


I noticed that KisCircleMaskGenerator::valueAt(), which can easily be
called millions of times in a single stroke, has some rather
inefficient code (in particular, an unnecessary sqrt()), so I took the
liberty of optimizing the code a bit. This patch should somewhat
improve the performance of large brushes, especially the sketch brush
with a large diameter. No, it is not a large difference.

On my machine, the old code took about 26 nanoseconds per call, and
the new code takes 15 nanoseconds per call.

(Raw data: old code, time per call: 2.6188e-08, 2.6148e-08, 2.612e-08,
2.6688e-08, 2.668e-08, 2.6868e-08. New code: 1.4952e-08, 1.5532e-08,
1.4972e-08, 1.4964e-08, 1.4892e-08, 1.4868e-08, 1.4876e-08,
1.5144e-08, 1.4872e-08, 1.4872e-08, 1.4876e-08. Each sample is an
average over 2.5 billion calls)


--
Segmentation fault
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-KisCircleMaskGenerator-valueAt-optimize-arithmetic.patch
Type: application/octet-stream
Size: 2730 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kimageshop/attachments/20101223/466a3c78/attachment.dll 


More information about the kimageshop mailing list