Krita useable for Blender movies

Boudewijn Rempt boud at valdyas.org
Fri Oct 23 14:22:37 CEST 2009


On Friday 23 October 2009, Thomas Zander wrote:

> My suggestion would be to avoid this lookup altogether; use the strategy
> design pattern and instead of having an Id (either string or integer) you
>  can just store a pointer to the method/class that implements your code.

That's already done. This file is really old and the implementation dates back 
to when composite ops were identified by const ints. And, of course, 
comparison of const QString's isn't as expensive as one would expect, since 
it's all implicitly shared.

> http://en.wikipedia.org/wiki/Strategy_pattern
> 
> > [1] libs/pigment/colorspaces/KoRgbU8CompositeOp.cpp:65
> 
> A quick optimization for this would be to cache the qstring at the start of
> the method and not call id() every time.
> Sorting on most used composite op to be at top helps too, I'd guess that
>   if (id() == COMPOSITE_UNDEF)
> is called a lot more than needed...

I suspect it's hardly called at all. As Cyrille said, talking about 
performance optimization without running valgrind is worse than useless. We 
have done a lot of profiling already and we know where the hotspots currently 
are, and it's not in this legacy code that only is used for a relatively small 
number of less used composit ops.

-- 
Boudewijn Rempt | http://www.valdyas.org


More information about the kimageshop mailing list