the test using the old code finally finished. it took almost 14 minutes.
(the new code takes 0.8 seconds. i'd say it's an improvement.)

jim

On Sat, Jan 05, 2002 at 11:02:51PM +0200, Andi Gutmans wrote:
> Nice!
> 
> At 08:46 PM 1/5/2002 +0000, jim winstead wrote:
> >jimw            Sat Jan  5 15:46:45 2002 EDT
> >
> >  Modified files:
> >    /php4/ext/standard  string.c
> >    /php4/ext/standard/tests/strings    wordwrap.phpt
> >  Log:
> >  New memcpy()-based wordwrap() implementation. The simple case
> >  (single-character break, no forced break) appears to be about 60%
> >  faster, and there's simply no comparison for non-simple cases with
> >  non-trivial amounts of text. The old algorithm was O(n^2) (with an
> >  unfortunately large constant factor) because of the use of strncat(),
> >  the new one is O(n). Added some more tests, too.
> >  @ - Made wordwrap() significantly faster. (Jim)
> >  # test case: $t = join('',file('ChangeLog')); $w = 
> >  wordwrap($t,10,"\n",1);
> >  # new code completes in less than a second. i'm still waiting for the
> >  # old code to finish.
> >
> >
> 

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to