Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46687 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42795 invoked from network); 13 Jan 2010 13:51:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jan 2010 13:51:29 -0000 Authentication-Results: pb1.pair.com smtp.mail=dave@dmi.me.uk; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dave@dmi.me.uk; sender-id=pass; domainkeys=good Received-SPF: pass (pb1.pair.com: domain dmi.me.uk designates 77.68.52.130 as permitted sender) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: dave@dmi.me.uk X-Host-Fingerprint: 77.68.52.130 server77-68-52-130.live-servers.net Received: from [77.68.52.130] ([77.68.52.130:39986] helo=scaramanga.siterage.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 19/AD-00773-FDFCD4B4 for ; Wed, 13 Jan 2010 08:51:28 -0500 Received: from localhost (scaramanga.siterage.net [127.0.0.1]) by scanner.scaramanga.siterage.net (SiteRage Mail Server) with ESMTP id 90C7183BF6; Wed, 13 Jan 2010 13:51:24 +0000 (GMT) X-Spam-Flag: NO X-Spam-Score: -3.939 X-Spam-Level: X-Spam-Status: No, score=-3.939 required=5 tests=[ALL_TRUSTED=-1.8, AWL=0.460, BAYES_00=-2.599] autolearn=ham Received: from scaramanga.siterage.net ([127.0.0.1]) by localhost (scaramanga.siterage.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Y6+Oi4IUoS0U; Wed, 13 Jan 2010 13:51:24 +0000 (GMT) Received: from [192.168.1.65] (host86-170-198-70.range86-170.btcentralplus.com [86.170.198.70]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by scaramanga.siterage.net (SiteRage Mail Server) with ESMTPSA id 8D45C6E33A; Wed, 13 Jan 2010 13:51:23 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dmi.me.uk; s=scara-dkim; t=1263390684; bh=T3jrS8w3t3D+X2wGVXbNjOTQkJoN5C8lqnwSkmKhkR0=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=NVoI+8nfkETw/M+u9nHIOeyxz/hYMFuzZN5uK7Rp6Mg/V+KIGPe4iSPDdi8TNNiSa owgx8vRBKpPwaOjQv6MOB6xWZn7IoUxSakaC6Yk4oAq51bzLNZ5/t+mAzMeAvdSX91 USfGQk6G1PBACJbBF+Y3SE1KFpUocBS6mRRxbAx0= DomainKey-Signature: a=rsa-sha1; s=scara-dk; d=dmi.me.uk; c=simple; q=dns; h=message-id:date:from:user-agent:mime-version:to:cc:subject: references:in-reply-to:content-type:content-transfer-encoding; b=I3mciUSvmB9W5BZgkqHIRS0fSlKqGdIZzEJd01AK3TS2RWGh5Gkkob0IsCakwQfrE L+XJgVOs7nbq33ffpLgozhqbaqMNwc+8smcDuulknDbSAkVpJmbUWxOEutTzn03anvU /N8NB648B75oqVEg5jJGQSv4vniEImZoDes/vAo= Message-ID: <4B4DCFDA.6090206@dmi.me.uk> Date: Wed, 13 Jan 2010 13:51:22 +0000 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 MIME-Version: 1.0 To: "mathieu.suen" CC: Sebastian Bergmann , internals@lists.php.net References: <4B4DABED.4060202@easyflirt.com> <4B4DBF40.5040801@easyflirt.com> In-Reply-To: <4B4DBF40.5040801@easyflirt.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] About optimization From: dave@dmi.me.uk (Dave Ingram) mathieu.suen wrote: > Sebastian Bergmann wrote: >> Am 13.01.2010 12:18, schrieb mathieu.suen: >> >> Because any optimization, even very simple ones, impose a performance >> penalty in the default execution model of PHP which does not use a >> bytecode cache. >> > > For simple optimization I don't think so. Take the simple example: > > > function foo() > { > $a = 45; > return $a; > } > > Here if you don't optimize you are creating a variable. So you put > pressure on the gc and the memory. But most of the time, the act of optimising will take longer than just compiling and running the code, because you have to make decisions about whether something can be optimised and the best way to do it. As Sebastian said, it only makes sense to invest that time when you're going to be reusing the compiler output. Without an opcode cache, PHP just throws away the results of the compilation, so there are zero advantages to optimisation. > Best would be some benchmark. > By the way why there is no native bytecode cache ? > > >> Only when the bytecode is not regenerated for each execution does it >> make sense to invest for time for the then one-time compilation. >> >> > > Sorry I don't understand what do you mean? What Sebastian means is that it would only make sense to optimise if you're going to cache the output -- otherwise it is simply wasted time that could be better spent on other things. Dave