Some more experiments

Boudewijn Rempt boud at valdyas.org
Wed Jun 6 19:53:59 CEST 2007


In my experiments, the thumbnailing, dab compution and mask scaling showed up 
largely, and I've tuned that code a bit. Still... I get the following result 
with valgrind (using -O2) and thread for composition in KisBrushop::paintAt:

* computeDab: 40%, of which 25% is spent in removeReader/addReader from 
KisTiledIterator::fetchTileData.

* scaleMask: 19%

* bitBlt: 26%, of which about 26% in createRandomAccessor, 8% in addDirtyRect 
(QRegion, that is), 20% in KoColorSpace::bitBlt (the real work) and 24% in 
the destructor of KisRandomConstAccessor.

Of the 50% time spent in creating and deleting the random accessors, about 30% 
is spent adding and removing readers in KisTile.

The big problem here locking on the KisTileManager -- this is, in effect, a 
global lock that serializes all tile access because it mutexes on the KTM 
every time the number of readers and writers drops below 1 -- which is 
always, since having more than one reader on a tile is very rare. So for 
every tile access we access KisTileManager, which is a globally locked 
singleton.

One idea I have is to have a swappable flag on KisDataManager so small, 
ephemeral paint devices aren't subject to swapping so we can skip the calls 
to KisTileManager for them. Another is to add a KisPainter::bitBlt() method 
that takes as source an array of bytes instead of a QImage or QPaintDevice.

Maybe it would be better to replace the reader counting with timestamp tagging 
& then mark & sweep collecting of tiles for compression in a separate thread. 
A tile garbage collector.

Anyway, I'll commit what I have done soon -- either it's good, which is good, 
or it's bad, in which case Bart can consider himself prodded :-)

-- 
Boudewijn Rempt 
http://www.valdyas.org/fading/index.cgi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kimageshop/attachments/20070606/e898815d/attachment.pgp 


More information about the kimageshop mailing list