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

List:       squirrelmail-cvs
Subject:    Re: [SM-CVS] SF.net SVN: squirrelmail: [12412]
From:       "Paul Lesniewski" <paul () squirrelmail ! org>
Date:       2007-05-19 12:56:10
Message-ID: 58191e420705190556n3a41d189x4fb2f7ba66c9c70c () mail ! gmail ! com
[Download RAW message or body]

On 5/19/07, Thijs Kinkhorst <kink@squirrelmail.org> wrote:
> On Friday 18 May 2007 12:17, pdontthink@users.sourceforge.net wrote:
> > +//FIXME: please document why it is we have to check the first char of the
> > flag but we then go ahead and do a full string comparison anyway. Is this
> > a speed enhancement? If not, let's keep it simple and just compare the
> > full string and forget the switch block.
>
> Yes, this is a well known strategy in parsers. The idea is that you do it like
> this:
>
> starts with R?
>   yes ->
>      is it References?
>        yes-> parse References
>      is it Reply-To?
>        yes -> parse Reply To
>      is it  Received?
>        yes -> parse Received
> starts with M?
>      is Message-ID?
>        yes -> parse Message-ID
>
> Say you have the header Message-ID, you would now do 3 comparisons (M=R, M=M,
> Message-ID=Message-ID) instead of 4 (Message-ID=References,
> Message-ID=Reply-To, Message-ID=Received). This is of course a simple case
> and the differences becomes larger for each new header you'd add.

Problem is that the code in this file is much more simple.  There is
only one real value under each letter listed.  So I don't think it
saves any cycles at all -- in terms of number of comparisons (ignoring
that they are different kinds), the way we have it ends up doing more
comparisons (I think exactly one more than necessary for any one
value).

  - Paul

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
--
squirrelmail-cvs mailing list
List Address: squirrelmail-cvs@lists.sourceforge.net
List Info: https://lists.sourceforge.net/lists/listinfo/squirrelmail-cvs
http://squirrelmail.org/cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

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