Hello all.
I would like to propose a replacement for current zend_u_strtod()
implementation.
The patch: http://tony2001.phpclub.net/dev/tmp/u_strtod.diff
According to my tests, new implementation is faster in about 40 (forty) times.
The simple script below takes ~1 sec to run with the patch and ~40 seconds without.
<?php
$a = array(
"0.1",
"1.",
"1.0",
"23423423.234234",
"0.00000E-2",
"0.000002E+3",
"121231312.1111",
"000.11111111",
);
$start = microtime(true);
for ($i = 0; $i<100000; $i++) {
foreach ($a as $d) { $double = (double)$d; }
}
var_dump(microtime(true) - $start);
?>
The only question here is which locale to use for number parsing/formatting.
I used "en_US_POSIX" and it doesn't seem to create any new problems, though I'd
like to hear your comments.
--
Wbr,
Antony Dovgal
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php