Re: zend_u_strtod() 400% speed up

From: Date: Fri, 10 Nov 2006 12:21:47 +0000
Subject: Re: zend_u_strtod() 400% speed up
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-26462@lists.php.net to get a copy of this message
On 11/10/2006 02:14 PM, Matt Wilmas wrote:
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
Hmm.. Actually, your version seems to be slightly faster (~15%) than mine and there are several advantages, like no formatter is required, avoiding parsing non-numeric strings and less TSRMLS_FETCH() calls, which leads to even better results on non-numeric strings. Also, it looks like a good idea to use zend_strtod() in both native and unicode modes.
BTW, your version would actually be 4000% faster, no? :-O
Yeah, not enough blood in my coffein =) -- Wbr, Antony Dovgal

« previous php.internals (#26462) next »