Okay, I got some test results.
First of all, both patches seem to be fine, they both fix several failed tests:
Zend/tests/zend_strtod.phpt
ext/standard/tests/array/range.phpt
ext/standard/tests/general_functions/001.phpt
ext/standard/tests/math/abs.phpt
ext/standard/tests/math/bug30069.phpt
Now the test results (average time in seconds spent on running the test script):
----------------------------------------------------------------
Platform current | Matt | Tony
----------------------------------------------------------------
Linux intel64 (ICU 3.6, non-ZTS) 104.20 18.93 29.93
Linux intel64 (ICU 3.6, ZTS) 106.38 19.78 31.97
Linux i386 (ICU 3.6, non-ZTS) 809.21 25.49 59.78
Linux i386 (ICU 3.6, ZTS) 708.43 30.22 59.90
Linux i386 (ICU 3.4, non-ZTS) 526.71 22.39 36.96
Linux i386 (ICU 3.4, ZTS) 435.27 26.20 37.87
FreeBSD i386 (ICU 3.6, non-ZTS) -- 20.66 33.47
----------------------------------------------------------------
(Yes, I'm too lazy to rebuild PHP on FreeBSD 4 times more, as the result is
clear).
So we got a clear winner here - the patch by Matt outperforms the patch of mine
by ~30%.
The patches:
http://tony2001.phpclub.net/dev/tmp/u_strtod.diff - my patch
http://tony2001.phpclub.net/dev/tmp/u_strtod1.diff - Matt's patch
The test script used:
<?php
$a = array(
"0.1",
"1.",
"1.0",
"23423423.234234",
"0.00000E-2",
"0.000002E+3",
"121231312.1111",
"000.11111111",
"",
"text",
str_repeat("text", 1000)
);
$start = microtime(true);
for ($i = 0; $i<1000000; $i++) {
foreach ($a as $d) { $double = (double)$d; }
}
var_dump(microtime(true) - $start);
?>
--
Wbr,
Antony Dovgal
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php