[Tickets #10949] Re: RFC822 parsing library very inefficient

bugs at horde.org bugs at horde.org
Wed Feb 1 08:08:53 UTC 2012


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/10949
------------------------------------------------------------------------------
  Ticket             | 10949
  Updated By         | Git Commit <commits at lists.horde.org>
  Summary            | RFC822 parsing library very inefficient
  Queue              | Horde Framework Packages
  Version            | Git master
  Type               | Enhancement
  State              | Assigned
  Priority           | 2. Medium
  Milestone          |
  Patch              |
  Owners             | Michael Slusarz
------------------------------------------------------------------------------


Git Commit <commits at lists.horde.org> (2012-02-01 08:08) wrote:

Changes have been made in Git (refs/heads/master):

commit 90462df31f5ec31200a1ed9144f6569e3a203d33
Author: Michael M Slusarz <slusarz at horde.org>
Date:   Sun Jan 29 21:04:06 2012 -0700

     [mms] Improved parser for e-mail addresses (Request #10949).

     The previous parsing method involved splitting at "important" RFC 822
     characters (e.g. < . :) and then brute-forcing to see if this was the
     correct decision.  New code goes through the string linearly, checking
     the grammar against the ABNF contained in the RFC.

     Performance statistics: On a message with 50 e-mail addresses,
     performance was 20x faster.  Within the script itself, total cumulative
     time within the parseAddressList() method went from 92% -> 7%.

     Real performance numbers are probably not quite this great. The new
     library substnatially reduces recursion.  Methods relying on recursion
     are artifically slowed down by xdebug since each function call has a
     more significant performance penalty than under regular PHP since
     xdebug needs to record data about each call. Even factoring this in,
     the new code is a substantial performance improvement - for messages
     containing substantial numbers of e-mail addresses (> 30), the limiting
     bottleneck was previously Rfc822 address parsing.  This should no longer
     be the case.

  framework/Mail/lib/Horde/Mail/Rfc822.php         | 1026  
+++++++++-------------
  framework/Mail/lib/Horde/Mail/Rfc822/Address.php |   74 ++
  framework/Mail/lib/Horde/Mail/Rfc822/Group.php   |   40 +
  framework/Mail/package.xml                       |   24 +-
  framework/Mail/test/Horde/Mail/ParseTest.php     |   59 +-
  5 files changed, 601 insertions(+), 622 deletions(-)

http://git.horde.org/horde-git/-/commit/90462df31f5ec31200a1ed9144f6569e3a203d33





More information about the bugs mailing list