[calligra/krita-iterators2-rempt] krita/image/tiles3: Handle the situation where the ng iterators get an empty stretch

Boudewijn Rempt boud at valdyas.org
Thu Apr 26 07:05:40 UTC 2012


On Wednesday 25 April 2012 Apr, Cyrille Berger Skott wrote:
> Hi,
> 
> Keep in mind that the driving factor for the design of the NG iterators was 
> performance, performance and performance, while retaining as much as possible 
> an API that is easy to use. The goal was to be at least as fast as extracting 
> layer data in a linear buffer, meaning the mechanism behind the iterators had 
> to be as simple as possible, with very few jumps, a reduced number of function 
> call and no useless code (remember, a cycle spent in the iterator is actually 
> 1milion cycles in a 1000x1000 image). And the NG iterators have lived to their 
> requirement.
> 
> They provide similar performance than copying layer data in a linear buffer, 
> and they are twice as fast as the old iterators.
> 
> The price we have to pay is that the API is a bit unusual, with a loop check 
> at the end, and that the user have to be careful not to use a null 
> width/height. I personnaly think that the fact that the problem happened only 
> once despite the widespread use of the iterators is proof that it is an 
> acceptable drawback.
> 

the big mistake we made was not immediately porting everything. We thought it would take too much time, but the actual porting of all of Krita I could do in three days -- assisted by a high fever, that is true.

There must be still some weirdnesses, since undo doesn't work on a second layer and we've still got some strange unittest failures in my branch. But I'm confident we can get that ironed out. The difference in performance is actually noticeable, even on my very fast desktop pc.

-- 
Boudewijn Rempt
http://www.valdyas.org, http://www.krita.org, http://www.boudewijnrempt.nl


More information about the kimageshop mailing list