Em 2013-01-11 0:32, Christopher Jones escreveu:
How does this compare with your baseline results?
I ran some benchmarks.
Configure line:
CC=gcc-mp-4.8 CFLAGS="-O3 -march=native" ./configure --disable-all
--host=x86_64-apple-darwin10 --build=x86_64-apple-darwin10
CPU: Intel(R) Core(TM) i5-2500S CPU @ 2.70GHz
The text being searched is this page copy pasted:
http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_vm_execute.h
The functions are run 30 time in a loop.
All new algorithm (branch cataphract/strtr_wu94):
Replacements: 13 total, smallest 6 largest 19
strtr: 0.1534
str_replace: 0.8625
Replacements: 14 total, smallest 1 largest 19
strtr: 0.5305
str_replace: 1.0654
Replacements: 1 total, smallest 7 largest 7
strtr: 0.1142
str_replace: 0.0985
Replacements: 2 total, smallest 7 largest 2500
strtr: 0.1165
str_replace: 0.1656
===
Old algorithm improved (branch cataphract/strtr):
Replacements: 13 total, smallest 6 largest 19
strtr: 0.8922
str_replace: 0.8606
Replacements: 14 total, smallest 1 largest 19
strtr: 1.2031
str_replace: 1.0687
Replacements: 1 total, smallest 7 largest 7
strtr: 0.4130
str_replace: 0.0991
Replacements: 2 total, smallest 7 largest 2500
strtr: 0.5886
str_replace: 0.1719
===
Current (branch master)
Replacements: 13 total, smallest 6 largest 19
strtr: 20.0317
str_replace: 0.8707
results match!
Replacements: 14 total, smallest 1 largest 19
strtr: 26.6792
str_replace: 1.1017
results match!
Replacements: 1 total, smallest 7 largest 7
strtr: 1.2030
str_replace: 0.0850
results match!
Replacements: 2 total, smallest 7 largest 2500
^C (got tired of waiting after a few minutes)
--
Gustavo Lopes
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php