Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:26459 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11521 invoked by uid 1010); 10 Nov 2006 11:14:24 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 11506 invoked from network); 10 Nov 2006 11:14:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Nov 2006 11:14:24 -0000 Authentication-Results: pb1.pair.com header.from=php_lists@realplain.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php_lists@realplain.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain realplain.com from 209.142.136.132 cause and error) X-PHP-List-Original-Sender: php_lists@realplain.com X-Host-Fingerprint: 209.142.136.132 msa2-mx.centurytel.net Linux 2.4/2.6 Received: from [209.142.136.132] ([209.142.136.132:45727] helo=msa2-mx.centurytel.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id ED/04-16675-D0F54554 for ; Fri, 10 Nov 2006 06:14:23 -0500 Received: from pc1 (d9-104.rt-bras.wnvl.centurytel.net [69.179.136.104]) by msa2-mx.centurytel.net (8.13.6/8.13.6) with SMTP id kAABEI3I027060; Fri, 10 Nov 2006 05:14:18 -0600 Message-ID: <017f01c704b9$5e07f870$0201a8c0@pc1> To: "php-dev" , "Antony Dovgal" References: <455455D1.3020706@zend.com> Date: Fri, 10 Nov 2006 05:14:19 -0600 MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" 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() 400% speed up From: php_lists@realplain.com ("Matt Wilmas") 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