diff options
author | jim winstead <jimw@php.net> | 2002-01-05 20:46:43 +0000 |
---|---|---|
committer | jim winstead <jimw@php.net> | 2002-01-05 20:46:43 +0000 |
commit | ca15b22212d3ea30c931e4cb7f4e1be869ed36fc (patch) | |
tree | 625d05aa1b7484346d79a5b64070c8fed07a2313 /ext/domxml/php_domxml.c | |
parent | e56fb1639b9c5da4f4d6b6b7b9c99888bfdd045b (diff) | |
download | php-git-ca15b22212d3ea30c931e4cb7f4e1be869ed36fc.tar.gz |
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.
Diffstat (limited to 'ext/domxml/php_domxml.c')
0 files changed, 0 insertions, 0 deletions