Re: KDE/kdelibs/kstyles/keramik

David Faure <[email protected]> Thu, 23 Mar 2006 14:16:49 +0100
Newsgroups gmane.comp.kde.devel.optimize
Organization KDE
Message-ID <[email protected]>
On Tuesday 21 March 2006 14:18, Fabio Pedretti wrote:
> Hi,
> sorry if I haven't replied sooner.
> What's the status of the conversion from 8 to 32bpp? Is this conversion too slower for some type of image?
Well I assumed that you checked that before converting the PNGs, but apparently you didn't.
If you're "optimizing" the images, it would be good to make sure that this doesn't slow down their loading.
After all hard disk space is cheap compared to runtime delays...

Here's a test program, put it in an empty dir and compile it with "qmake -project ; qmake ; make",
(you need Qt4), and run it with various PNGs as argument. Of course, on a system that is not otherwise
loaded since it measures actual time. I guess one could combine this with the time command to get
wall-clock independent data.

$ time ./pixmaptest /devel/kde/src/www/areas/koffice/kformula/pics/hi48-app-kformula.png
loading /devel/kde/src/www/areas/koffice/kformula/pics/hi48-app-kformula.png 1000 times...
loading /devel/kde/src/www/areas/koffice/kformula/pics/hi48-app-kformula.png 1000 times took 103 milliseconds
./pixmaptest /devel/kde/src/www/areas/koffice/kformula/pics/hi48-app-kformula.png  0,16s user 0,02s system 87% cpu 0,203 total

> Can I optimize png in KDE 3.5 branch?
Please don't, at least until this issue is resolved.

-- 
David Faure, [email protected], sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).

_______________________________________________
Kde-optimize mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-optimize
qpixmaptest.cpp (text/x-c++src, 490 B)
#include <QTime>
#include <QApplication>
#include <QPixmap>

int main( int argc, char** argv )
{
  if ( argc < 2 ) return 1;
  QApplication app( argc, argv );
  QTime time;

  const int nr = 1000;
  printf( "loading %s %d times...\n", argv[ 1 ], nr );

  QPixmap pix;
  time.start();
  for ( int i = 0; i < nr ; ++i ) {
      pix.load( argv[ 1 ] );
      Q_ASSERT( !pix.isNull() );
  }
  printf( "loading %s %d times took %d milliseconds\n", argv[ 1 ], nr, time.elapsed() );
  return 0;
}