[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    Re: [PATCH] simplify strToHtml by using regexps
From:       Marc Mutz <Marc.Mutz () uni-bielefeld ! de>
Date:       2001-09-30 18:30:35
[Download RAW message or body]

On Sunday 30 September 2001 10:29, Michael Häckel wrote:
<snip>
> Nevertheless I measured the parsing speed with a huge text only mail.
> With the current implementation it took 23 seconds to display
> (including MIME and HTML parsing), with your implementation 78
> seconds.
> Therefore I definitely prefer the current implementation.
<snip>

If it's only for speed, then the regexp-version can probably be sped up 
quite a bit, since strToHtml is called line-wise (right?).

- \n can only occur at the end of the string, so we don't need to search 
for it.
- replace the one-char regexps with a single one "[ \t&<>]" and use 
QString::find(), QString::replace(uint,uint,QString&) instead of 
::replace(QRegExp&,QString&). This would make implementing tab 
expansion easy, too.

Shall I bother myself with doing so?

The most important asset of the regexp version is the ease in which they  
are maintained and extended. We could even load the mailto and http/ftp 
regexp's from the config file for easy testing. I saw this while I 
tried to track down the 70 @ bug. It was much faster to write the 
regexp version than trying to digest what the old version was doing. 

Already, the regexp version handles a dot at the end of urls perfectly 
well (ie. doesn't consider it part of the url):
See http://www.w3c.org/blah.html. <- dot not included.

We could expand it to include terms like www.kernel.org by just adding a 
single character... Or think of 
http://www.blah.org/blubb.html?query=foo&index=long#ref-14

Marc

_______________________________________________
Kmail Developers mailing list
Kmail@mail.kde.org
http://mail.kde.org/mailman/listinfo/kmail

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic