Re: zend_u_strtod is slow - possible fix
| From: | Andrei Zmievski | Date: | Tue, 01 Aug 2006 18:02:36 +0000 |
| Subject: | Re: zend_u_strtod is slow - possible fix | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-25082@lists.php.net to get a copy of this message | ||
Yes. With your patch applied, the numeric unicode string to double conversion is about 100% slower than from binary strings. If this is acceptable we can commit the patch. Otherwise, we should port zend_strtod() to deal with unicode strings directly.
-Andrei
On Jul 31, 2006, at 1:58 AM, Matt W wrote:
Hi all, As I was working on upgrading the dec[bin|hex|oct] functions to convert large doubles, I noticed how much slower things were when converting Unicode strings to double. I found that converting the whole thing to string and using regular zend_strtod() was much faster. Then I decided to try modifying the u_strtod() function to do the same, but just on the relevant numeric portion. I don't know if I did everything right, but it seems to work fine with my limited testing. (I was working from zend_u_strtol() and zval_unicode_to_string_ex(). :-)) The function is now about *8 times* faster, and nearly 20 times faster on a non-numeric string! (I'm on Windows.) diff: http://realplain.com/php/zend_u_strtod.diff Is this something that can be used? Thanks, Matt -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php