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

List:       kde-core-devel
Subject:    Re: widget style cleanup
From:       "Maksim Orlovich" <mo85 () cornell ! edu>
Date:       2004-09-14 5:11:53
Message-ID: 20150.24.58.6.92.1095138713.squirrel () 24 ! 58 ! 6 ! 92
[Download RAW message or body]

>> You're getting ahead of yourself, but no problem w/the move itself.
>> However, plastik needs some performance work.
> To be honest, I didn't notice these general performance problems.

I am not sure they're noticeable, they're easily measurable.

> So if you could help me identifying them, I would love trying to improve
> this situation.

Please see the attached .cpp file; apologies for the uglyness, not meant
to be any sort of production code. This is basically what I used to tune
keramik --- it just hammers on PE_ButtonCommand which for Ker hits the
core rendering path -- and I think Plastik is similar with its bevel
rendering accessible from here and occuring all over the place (please
correct me if I am wrong)

Here, when I run this with Keramik, I get it finishing in 26.5 seconds, of
which 15.5 are in-process (that's the "clock:" line, the portions is -way-
too high, likely due to all the temporary TilePainter objects; I hope
nextgen designs I do can eliminate that; hard to do w/the current
codebase).  Light3 comes in at much quicker 9.2 seconds... Plastik takes
200 seconds to run this app here, with 88 in-process, which is 7.5 times
slower than keramik, and 21.7 times slower than Light3. A candidate for a
drag on speed are all the save()/restore() calls, but I am not sure: for
some reason I recall these functions as being slow, but I don't have a
rationale.


-Maks

["TestBtnSpd.cpp" (application/octet-stream)]

#include <qapplication.h>
#include <qimage.h>
#include <qpainter.h>
#include <qpixmap.h>
#include <qstyle.h>
#include <qstylefactory.h>

#include <time.h>
#include <sys/timeb.h> 
#include <iostream>

using namespace std;

int main(int argc, char** argv)
{
	QString style = "keramik";
	QApplication qapp(argc, argv);
	
	if (argc == 2)
		style = argv[1];
	cout<<"Testing style:"<<style.latin1()<<"\n";
	
	QStyle *s1 = QStyleFactory::create(style);//keramik");//"highcolor");//);
	QWidget dest;
	dest.resize(300,300);
	dest.show();
	//QPixmap dest(300,300);
	QPainter p(&dest);
	
	//for (int c=0; c<93333; c++)
	//{}
	
	
	clock_t stime = clock();
	timeb astart, aend;
	ftime(&astart);
	
	const int len = 25000;
	int w;
	for (int run = 0; run < len; run++)
	{
		w = 0;
		for (int x=30; x<300; x+=10)
		{
		//for (int y=10; y<300; y++)
		s1->drawPrimitive(QStyle::PE_ButtonCommand, &p, QRect(0,0,x,40),
									QApplication::palette().active(), 
									QStyle::Style_Enabled);
			w += x;
		}
	}
	clock_t etime = clock();
	ftime(&aend);
	//time_t aend=time(0);
	
	std::cout<<"Clock:"<<(float)(etime-stime)/CLOCKS_PER_SEC<<"\n";
	
	
	
	long long time_diff = (aend.time - astart.time)*1000+aend.millitm - astart.millitm;
	
	std::cout<<"Total:"<<(float(time_diff)/1000)<<"\n";
	float fillRate = len*40*w/(float(time_diff)/1000);
	std::cout<<"Fillrate, pixel/sec:"<<fillRate<<"\n";
	//dest.convertToImage().save("image.png","PNG");

}


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

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