[Tickets #8627] Re: Improve String::wordwrap() performance

bugs at horde.org bugs at horde.org
Thu Sep 29 14:40:15 UTC 2011


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

Ticket URL: http://bugs.horde.org/ticket/8627
------------------------------------------------------------------------------
  Ticket             | 8627
  Updated By         | evert at rooftopsolutions.nl
  Summary            | Improve String::wordwrap() performance
  Queue              | Horde Framework Packages
  Version            | FRAMEWORK_3
  Type               | Enhancement
  State              | Accepted
  Priority           | 1. Low
  Milestone          |
  Patch              |
  Owners             |
------------------------------------------------------------------------------


evert at rooftopsolutions.nl (2011-09-29 14:40) wrote:

I isolated this problem down to the user of iconv_substr. It's  
incredibly slow compared to mb_substr, and it gets called *a lot*.

Here's a benchmark script:
http://pastebin.com/r63kUt22

On my mac, the difference is very much visible, but not terrible performance:

iconv_substr: 0.014400005340576
mb_substr: 0.00049901008605957
substr: 3.7193298339844E-5

On 2 linux machines we tried, the numbers looked more like this:

iconv_substr: 8.3735179901123
mb_substr: 0.00039505958557129
substr: 4.8160552978516E-5

Yes that's 8 seconds for iconv_substr,  0.0004 seconds for mbstring  
and 0.00005 for the non-unicode aware function.

So my fix is to change Horde_String::substr and prefer mbstring over iconv





More information about the bugs mailing list