Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64931 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75650 invoked from network); 14 Jan 2013 10:42:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jan 2013 10:42:38 -0000 Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.21 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.21 smtp1.ist.utl.pt Linux 2.6 Received: from [193.136.128.21] ([193.136.128.21:54489] helo=smtp1.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 61/D2-59585-911E3F05 for ; Mon, 14 Jan 2013 05:42:34 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp1.ist.utl.pt (Postfix) with ESMTP id CED5B7000490 for ; Mon, 14 Jan 2013 10:42:29 +0000 (WET) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp1.ist.utl.pt ([127.0.0.1]) by localhost (smtp1.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id rxaCaqfuzjgT for ; Mon, 14 Jan 2013 10:42:29 +0000 (WET) Received: from nebm.ist.utl.pt (unknown [IPv6:2001:690:2100:4::58:1]) by smtp1.ist.utl.pt (Postfix) with ESMTP id 6269E700048D for ; Mon, 14 Jan 2013 10:42:29 +0000 (WET) Received: from localhost ([127.0.0.1] helo=nebm.ist.utl.pt) by nebm.ist.utl.pt with esmtp (Exim 4.72) (envelope-from ) id 1TuhUr-00083A-1R for internals@lists.php.net; Mon, 14 Jan 2013 10:42:29 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 14 Jan 2013 11:42:28 +0100 To: Organization: =?UTF-8?Q?N=C3=BAcleo_de_Engenharia_Biom=C3=A9dica_do_Insti?= =?UTF-8?Q?tuto_Superior_T=C3=A9cnico?= In-Reply-To: <50EF4F71.9080701@oracle.com> References: <50EF4F71.9080701@oracle.com> Message-ID: X-Sender: glopes@nebm.ist.utl.pt User-Agent: RoundCube Webmail/0.8-rc Subject: Re: [PHP-DEV] strtr vs. =?UTF-8?Q?str=5Freplace=20runtime?= From: glopes@nebm.ist.utl.pt (Gustavo Lopes) Em 2013-01-11 0:32, Christopher Jones escreveu: > > How does this compare with your baseline results? > I ran some benchmarks. Configure line: CC=gcc-mp-4.8 CFLAGS="-O3 -march=native" ./configure --disable-all --host=x86_64-apple-darwin10 --build=x86_64-apple-darwin10 CPU: Intel(R) Core(TM) i5-2500S CPU @ 2.70GHz The text being searched is this page copy pasted: http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_vm_execute.h The functions are run 30 time in a loop. All new algorithm (branch cataphract/strtr_wu94): Replacements: 13 total, smallest 6 largest 19 strtr: 0.1534 str_replace: 0.8625 Replacements: 14 total, smallest 1 largest 19 strtr: 0.5305 str_replace: 1.0654 Replacements: 1 total, smallest 7 largest 7 strtr: 0.1142 str_replace: 0.0985 Replacements: 2 total, smallest 7 largest 2500 strtr: 0.1165 str_replace: 0.1656 === Old algorithm improved (branch cataphract/strtr): Replacements: 13 total, smallest 6 largest 19 strtr: 0.8922 str_replace: 0.8606 Replacements: 14 total, smallest 1 largest 19 strtr: 1.2031 str_replace: 1.0687 Replacements: 1 total, smallest 7 largest 7 strtr: 0.4130 str_replace: 0.0991 Replacements: 2 total, smallest 7 largest 2500 strtr: 0.5886 str_replace: 0.1719 === Current (branch master) Replacements: 13 total, smallest 6 largest 19 strtr: 20.0317 str_replace: 0.8707 results match! Replacements: 14 total, smallest 1 largest 19 strtr: 26.6792 str_replace: 1.1017 results match! Replacements: 1 total, smallest 7 largest 7 strtr: 1.2030 str_replace: 0.0850 results match! Replacements: 2 total, smallest 7 largest 2500 ^C (got tired of waiting after a few minutes) -- Gustavo Lopes