On Tuesday 06 March 2007 03:07, Charles Connell wrote:
> > > Known problems:
> > > 1. Speed? Unescape was also the bottleneck for performance, and I'm not
> > > sure if QTextDocument's equivalent functions are any better (or worse)
> >
> > I would still like to see a way to avoid unescape entirely. [...]
> >
> > There must be a way to figure that out without expensive conversions...
>
> I believe that unescape is never called in my code, only toPlainText(). I'm
> sincerely hoping that that isn't as expensive, because I use it in
> plainBody() obviously, and I know that that is called in many places
> throughout Kopete.

Is it used that much? Most code that I remember uses the rich text body, not 
plain text.

In any case, the problematic code is formatStyleKeywords() in the chat part. 
That one is called for *ALL* messages in an open chat in at least two cases:

1. the other user changes his/her avatar
2. you change chat window style

Both result in multi-second freeze and 100% CPU usage because of all the 
expensive calculations. Unescape() is the symptom, not the cause. 
toPlainText() may or may not be faster, but is probably still too slow for on 
the fly work, so Kopete::Message::isRightToLeft can stay to do the caching.

What may or may not be faster for the RTL detection is to not do

  d->isRightToLeft = d->body->toPlainText().isRightToLeft();

but

  d->isRightToLeft = d->body->begin().text().isRightToLeft();

Requires cachegrinding and additional regression tests to see if this is both 
technically and performance-wise an improvement.

> Anyways, I'm back with a patch for the issues you raised. I would be happy
> to hear more from anyone about it.

Matt offered review, I'll assume he can provide you with more feedback.

Thanks so far for your work!

> Also, just a note: the attached diff is the diff between SVN trunk and my
> development copy. It is not a diff to my previous patch's merged code or
> anything funky like that.

If you want that, you may want to install patchutils, notably interdiff.

-- 
Martijn

Even a pigeon can make a deposit on a Mercedes!
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel

Reply via email to