Revision 637222

Go back to digest for 4th March 2007

Optimization in Networking Tools

Martijn Klingens committed changes in /branches/KDE/3.5/kdenetwork/kopete/libkopete/kopetemessage.cpp:

Make Kopete::Message::unescape a whopping 4 times as fast by eliminating QRegExp.

Of the remaining cycles, about 2/3rd goes to QString::fromLatin1() and ~QString(), but that can't be optimized in KDE 3.5. (Moving it out of the loop had actually a negative effect because not all strings are created as much.) When porting to KDE 4, consider static QLatinStrings to avoid the creation of those objects altogether.

The other 1/3rd of time goes to the block of QString::replace() calls at the bottom. Can be optimized relatively trivial by using a similar loop as the new code for elements, but that is *much* less readable, so I hope that won't be needed for acceptable speed. Another 75% on code that just got 50% faster is not bad anyway ;)

File Changes

Modified 1 files
  • /branches/KDE/3.5/kdenetwork/kopete/libkopete/kopetemessage.cpp
1 files changed in total