MW

Tag speed

Recent Posts

Profiling Rocks - KDevelop CMake Support now 20x faster (March 31, 2010)

I just need to get this out quickly:

We were aware that KDevelop’s CMake support was slow. Too slow actually. It was profiled months ago and after a quick look that turned up QRegExp, it was discarded in fear of having to rewrite the whole parser properly, without using QRegExp. Which btw. is still a good idea of course.

But well, today I felt like I should do some more tinkering. I mean I managed to optimize KDevelop’s Cpp support recently (parsing Boost’s huge generated template headers, like e.g. vector200.hpp is now 30% faster). I managed to make KGraphViewer usable for huge callgraphs I produce in Massif Visualizer. So how hard could it be to make KDevelop’s CMake at least /a bit/ faster, he?

Yeah well an hour later and two commits later, I managed to find and fix two bottlenecks. Both where related to QRegExp. Neither was the actual parser, instead it was the part that evaluated CMake files, esp. the STRING(...) function. So even if we’d used a proper parser generator, this would still been slow.

continue reading...

profile.class.php (June 24, 2008)

Every now and then I want to profile a given part of PHP code. For example I want to quickly check wether my current changeset to GeSHi works faster or is horribly slower. For a big change I’ll stick to Xdebug and KCachegrind. But for a quick overview? Overkill in my eyes.

Say hello to profile.class.php, a simple timer class for PHP5 which you can use to get an overview about where how much time is spent. This is in no way a scientific method nor should you take the results of a single run as a basis for you decisions.

I’ve set an emphasize on an easy API so you don’t have to pollute your code with arbitrary hoops and whistles.

UPDATE: You can find the current updated source in the SVN repo of GeSHi.

Simple example

This is a quick example on how you could use the class:

    <?php
    require 'profile.class.php'; // should be obvious ;-)
     
    // here might be uninteresting code
     
    profile::start('overall'); // start a timer and give it a name
                                       // we add this one to get a time
                                       // for the overall runtime
     
    // this is the code you want to profile
    profile::start('$_SERVER');
    $foo = count($_SERVER);
    profile::stop(); // stop the last active counter
     
    profile::start('$GLOBALS');
    $bar = count($GLOBALS);
    profile::stop();
     
     
    profile::stop(); // stop overall timer
    profile::print_results(profile::flush()); // print the results

continue reading...

Opera 9.50 beta (September 04, 2007)

Opera released their first 9.5 Alpha today, nicknamed Kestrel. Usually I don’t use Opera, I use Firefox for webdevelopment with Firebug and similar tools but it’s pretty slow even on my fast new machine. For my everyday browsing I use Konqueror for it’s neat desktop integration (read ASpell, KWallet, Kio, Filebrowser etc.). And compared to Firefox Konqueror is fast.

But Opera… Well I knew it was fast but in their release note they mentioned even more speed improvements, also for ECMA Script (JavaScript). So I thought, lets give it a try and I have to say I’m pretty much flabbergasted. It feals like it’s more than double as fast as Konqueror! I really might start to use Opera more frequently now… Let’s see what else they got except speed!

Also very interesting is this part of the release note:

Platform integration

We worked to make Kestrel feel even more integrated with your platform. Mac users can expect a nice new visual look and feel, while Opera for Linux will add a QT4 build, so you can easily adjust your skin to match the desktop. 64-bit Linux/FreeBSD packages will also be available.

continue reading...