Hi Antony, ----- Original Message ----- From: "Antony Dovgal" Sent: Friday, November 10, 2006
> 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. Cool. :-) I'd just been thinking about zend_u_strtod() again -- if you see my thread asking Andrei about the Unicode characters allowed as numbers... I changed the function back in the summer to be about 8x faster by converting FROM Unicode and using the regular zend_strtod(), but it was just a quick hack, so maybe better that it wasn't applied! http://realplain.com/php/zend_u_strtod.diff BTW, your version would actually be 4000% faster, no? :-O > 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. Since Andrei and README.UNICODE say only ASCII characters in en_US_POSIX locale, I'd think you're right. :-) I was thinking, now that I know only basic ASCII digits are allowed, zend_u_strtod() could manually grab the valid [prefix of] numbers, put them in a char[some_size] buffer and use the regular zend_strtod(), etc. But it doesn't seem like that would beat your version! Just looking at the code again, I don't think it sets *endptr correctly with a partial match (123.4foo)? Is "pos" set to the number of chars scanned? > -- > Wbr, > Antony Dovgal Matt -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php