Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:26650 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76680 invoked by uid 1010); 16 Nov 2006 19:22:28 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 76665 invoked from network); 16 Nov 2006 19:22:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Nov 2006 19:22:28 -0000 Authentication-Results: pb1.pair.com header.from=antony@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=antony@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: antony@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from [212.25.124.162] ([212.25.124.162:21351] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8D/87-01084-17ABC554 for ; Thu, 16 Nov 2006 14:22:27 -0500 Received: (qmail 29654 invoked from network); 16 Nov 2006 19:20:56 -0000 Received: from internal.zend.office (HELO ?127.0.0.1?) (10.1.1.1) by internal.zend.office with SMTP; 16 Nov 2006 19:20:56 -0000 Message-ID: <455CBA6C.4060801@zend.com> Date: Thu, 16 Nov 2006 22:22:20 +0300 User-Agent: Thunderbird 1.5.0.7 (X11/20060909) MIME-Version: 1.0 To: Andrei Zmievski CC: Matt Wilmas , php-dev References: <455455D1.3020706@zend.com> <017f01c704b9$5e07f870$0201a8c0@pc1> <45546EDB.2020400@zend.com> <011b01c70721$ca0ec7f0$0201a8c0@pc1> <0e7bb4f7f12e57e899a6c4b26068b93e@gravitonic.com> In-Reply-To: <0e7bb4f7f12e57e899a6c4b26068b93e@gravitonic.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] zend_u_strtod() 400% speed up From: antony@zend.com (Antony Dovgal) On 11/16/2006 08:59 PM, Andrei Zmievski wrote: > Matt and Antony, > > I this we should go with Matt's patch, since we care only about ASCII > characters in strings. Agree. I'm going to spend some time on this, re-test it once again and commit it after that. > On Nov 13, 2006, at 4:46 AM, Matt Wilmas wrote: > >> Hi Antony, >> >> ----- Original Message ----- >> From: "Antony Dovgal" >> Sent: Friday, November 10, 2006 >> >>> 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. >> >> Hmm, I don't understand how mine was faster if yours was 40x faster >> than the >> current version, as when I tested mine, it was only ~8x. :-/ >> >> Well anyway, as I mentioned in my first reply, I had another idea >> since I >> learned (from README.UNICODE and Andrei) that only ASCII digits are >> allowed >> in Unicode. I just put this together: >> http://realplain.com/php/zend_u_strtod.c I didn't test it (or even >> try to >> compile), but you get the idea -- "manually" copying the relevant >> Unicode >> chars to a char * (am I doing that right?). I've got the "char >> buf[64]" >> there, assuming it's more efficient than using emalloc() (?), when the >> number will fit. I didn't know what size to make it, just whatever >> catches >> the vast majority of cases... >> >> I'd really like to see a faster version implemented soon. :-) >> >> >> Matt > -- Wbr, Antony Dovgal