Version: (using KDE 3.5.9) Compiler: x86_64-pc-linux-gnu-g++ 4.1.2 20070214 ( (gdc 0.24, using dmd 1.020)) (Gentoo 4.1.2 p1.1) Installed from: Gentoo Packages Kopete eats up all the CPU load and freezes when the user receives a long line of characters. Steps of reproduction: * start Kopete * go online * let someone send you a very long line (e.g. your girlfriend throwing you a :******** kiss with a few hundred *'s in it) * enjoy the CPU load and killing Kopete after it freezes Expected results: * show the line * no freeze, no high CPU usage * your girlfriend not having the upper hand on remotely crashing your IM any more ;) I've only tested this with MSN so far and I managed to reproduce the bug 4 out of 4 tries. Interestingly when I *send* an immensely long line it doesn't crash.
Oh, dear. It seems I've misunderstood her — she didn't try to send me a long line of characters, but cca. a hundred animated smiles (the same one, only repeated a hundred times in the same "line"). Hmm, should I close this one and make a new bug?
The slow part is QTextDocument::setHtml in libkopete/kopetemessage.cpp Message::doSetBody. We use QTextDocument because we need toPlainText function. So is there any faster way to convert html to plain text? The next slower part is KEmoticonsTheme::tokenize but tokenize is 6 times faster than setHtml.
SVN commit 872704 by rjarosz: Fix bug 172485 Kopete has full CPU load (freezes) when receiving a long line. The message.setHtmlBody( message.parsedBody() ); which should cache the emoticons actually didn't cache it and it made it even worse because setHtml is much slower than parsedBody if we have many emoticons (html tags). So this patch removes this line and adds caching into the parsedBody function. The great thing is that we don't have to call setHtml which was the bottleneck. BUG: 172485 M +1 -9 kopete/chatwindow/chatmessagepart.cpp M +14 -3 libkopete/kopetemessage.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=872704
Will this be uploaded to trunk and if so, which version(s) will include the patch already?
This is already in trunk see Comment #3, I'll also backport it for KDE 4.1.3.
SVN commit 872808 by rjarosz: Backport SVN commit 872704. Fix bug 172485 Kopete has full CPU load (freezes) when receiving a long line. CCBUG: 172485 M +0 -5 kopete/chatwindow/chatmessagepart.cpp M +13 -3 libkopete/kopetemessage.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=872808
Thank you :)