[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kimageshop
Subject:    Easy to do optimization
From:       Cyrille Berger <cberger () cberger ! net>
Date:       2006-10-20 9:41:40
Message-ID: 200610201141.40248.cberger () cberger ! net
[Download RAW message or body]

Hi,
As soon as you see slow code, try to have a look at the code to see if we 
aren't creating a lot of unnecesserary objects, 90% of the time slow code is 
caused by this (the remain 10% are often caused by a lot of access to the 
tilesmanager, like with random accessor)

For instance:
* Avoid:
for(whatever)
{
	QColor c;
	...
}
Do:
QColor c;
for(whatever)
{

}
It might seems insignificant, but really it's not, on a loop of a milion of 
iterations, this is expensive as hell.

An other example:
* avoid
for(y = 0 to height)
{
	KisHLineIterator it = dev->createHLineIterator(0, y, width);
	for(whatever)
	{
		...
	}
}
Do:
KisHLineIterator it = dev->createHLineIterator(0, y, width);
for(y = 0 to height)
{
	for(whatever)
	{
		...
	}
	it.nextRow(); // or nextCol() if you are using a VLine iterator
}

Once we have done the two above optimization, we will allready have a much 
more faster krita :)
-- 
--- Cyrille Berger ---
_______________________________________________
kimageshop mailing list
kimageshop@kde.org
https://mail.kde.org/mailman/listinfo/kimageshop
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic