Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:25106 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8004 invoked by uid 1010); 2 Aug 2006 09:12:58 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 7989 invoked from network); 2 Aug 2006 09:12:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Aug 2006 09:12:58 -0000 X-PHP-List-Original-Sender: php_lists@realplain.com X-Host-Fingerprint: 69.179.208.43 msa3-mx.centurytel.net Linux 2.4/2.6 Received: from ([69.179.208.43:36145] helo=msa3-mx.centurytel.net) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id FF/53-45114-89C60D44 for ; Wed, 02 Aug 2006 05:12:58 -0400 Received: from pc1 (64-91-15-129.dyn.centurytel.net [64.91.15.129]) by msa3-mx.centurytel.net (8.13.6/8.13.6) with SMTP id k729Cqc3006310; Wed, 2 Aug 2006 04:12:52 -0500 Message-ID: <00b701c6b613$d5d7a070$0201a8c0@pc1> To: , "Andrei Zmievski" References: <001501c6b47f$7ee8f380$0201a8c0@pc1> Date: Wed, 2 Aug 2006 04:12:52 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 Subject: Re: [PHP-DEV] zend_u_strtod is slow - possible fix From: php_lists@realplain.com ("Matt W") Hi Andrei, Thanks for your reply. Yeah, obviously it'll still be slower than with an already-binary string. :-) But I figured it's better than before, until something better comes along... Unless there were other plans to rewrite it, is there a way to easily (for me! :-)) have it do all the conversion? I've been thinking about the different string-to-number functions (will send a separate e-mail)... Is there a reason the regular zend_strtod() code is so complicated? zend_string_to_double(), for example, is really simple (and works the same I assume, except for not handling negatives or leading whitespace). Can zend_u_strtod() be implemented with the same methods zend_string_to_double() uses? Thanks, Matt ----- Original Message ----- From: "Andrei Zmievski" Sent: Tuesday, August 01, 2006 > 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