Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64137 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93256 invoked from network); 3 Dec 2012 13:26:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Dec 2012 13:26:22 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain zend.com does not designate 209.85.216.42 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.216.42 mail-qa0-f42.google.com Received: from [209.85.216.42] ([209.85.216.42:47849] helo=mail-qa0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8B/A2-03565-C78ACB05 for ; Mon, 03 Dec 2012 08:26:21 -0500 Received: by mail-qa0-f42.google.com with SMTP id hg5so1560413qab.8 for ; Mon, 03 Dec 2012 05:26:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=xP02bggdEY4/RLCJNpJtje+c2GW7+9bA9tvCW4UoaY4=; b=JEB9+vlPiBAPtEStZn4FAG2634NtCNdTjSbDKQ4htlfHzdXe+wDMYWUb0hmJHbXzQA IweWH4vMQjBIXfW1TGCopmgyPyyM5YBYg3PjThlPhNhkIeuL3z6EQyMqcgR0WFtee/tX 8HXxOs272pCsOJwnx+EIWCzwrWTAxp8AyWM95SsEI28QLG0d7dM96zXCvPPmLlmqCpDH T2WCtgFH7XNmbUZLfglCx2fzDmrT+zqNHqDAs0g+5WXDJarTT3uiyRj6NTEg8WiDHCDY /FIHBXZfnJJEliaIU98k/1DVU3qFy94qsVFTC2MZ0KsB0lGMWzt6N0Qx+F5e28KteiOl 9LCA== MIME-Version: 1.0 Received: by 10.224.189.65 with SMTP id dd1mr16908574qab.79.1354541178168; Mon, 03 Dec 2012 05:26:18 -0800 (PST) Received: by 10.49.74.133 with HTTP; Mon, 3 Dec 2012 05:26:18 -0800 (PST) In-Reply-To: <201212031518.32545.yoram.b@zend.com> References: <201212031518.32545.yoram.b@zend.com> Date: Mon, 3 Dec 2012 16:26:18 +0300 Message-ID: To: yoram bar haim Cc: Rasmus Lerdorf , Derick , jpauli@php.net, PHP Internals Content-Type: multipart/alternative; boundary=20cf3033463fc226ac04cff2b1e8 X-Gm-Message-State: ALoCoQmJbG7tardFxHbfiJ+jIIYP2AT7zAJvN9d+m7zwjkD9dohLWpmDgv87pzrtyAaXp7GDpKrUZcvqtfR2S7JssA8XE6HlViN9xhbLwooFK7lExPUlpQAcizR/ZF6rkCWwEzIVEylx Subject: Re: [PHP-DEV] execute_data->Ts removing From: dmitry@zend.com (Dmitry Stogov) --20cf3033463fc226ac04cff2b1e8 Content-Type: text/plain; charset=UTF-8 Hi Yoram, Yeas, I checked memory reads on a release PHP built (with -O2 optimization level). The idea is very simple. Before the patch each access to TMP was implemented as: execute_data->Ts + offset GCC with -O2 kept execute_data in register but it needed to read execute_data->Ts anyway and then add the offset Now we just add the offset to execute_data directly. Also, the patch I published today is not compatible with 64-bit systems. I already fixed it, and the fix is minimal. Thanks. Dmitry. On Mon, Dec 3, 2012 at 5:18 PM, yoram bar haim wrote: > Hi Dmitry. > is this improvemnt (intruction reduce and memory read reduce) preserved > under > "strong" compiler optimization (-O2, -O3) ? > is it something that the compiler can not automatically optimize ? > anyhow, the patch seems impressive... > > On Monday, December 03, 2012 11:35:52 AM Dmitry Stogov wrote: > > The new proposed patch: http://pastebin.com/pj5fQTfN > > > > Now both execute_data->Ts and execute_data->CVs are removed and > > corresponding temporary and compiled variables accessed using > > "execute_data" as the base pointer. Temporary variables allocate directly > > before the "execute_data" in reverse order and compiled variables right > > after. So they can be accessed without any additional computations. The > > patch reduces the number of executed instructions and number of memory > > reads (about 8% less). > > > > I'm going to commit the patch on Tuesday. > > > > Thanks. Dmitry. > > > > On Mon, Dec 3, 2012 at 9:47 AM, Dmitry Stogov wrote: > > > Hi Rasmus, > > > > > > I'm glad the patch is not a big problem for APC. > > > BTW: I decided not to commit the patch as is, and implement the similar > > > optimization for CVs first. > > > Otherwise I may need to change the way TMP_VAR accessed twice. > > > I'll probably send the patch for review later today. > > > > > > Thanks. Dmitry. > > > > > > On Fri, Nov 30, 2012 at 11:48 PM, Rasmus Lerdorf > wrote: > > >> On 11/30/2012 09:15 AM, Dmitry Stogov wrote: > > >> > Hi, > > >> > > > >> > The NEWS and UPGRADING explains the details. > > >> > > > >> > http://pastebin.com/VC71Y8LV > > >> > > > >> > The patch is big, but actually quite simple. > > >> > I'm going to commit it on Monday or Tuesday (if no objections). > > >> > > > >> > I'm going to look into the similar optimization for CVs, but it's > > >> > going > > >> > > >> to > > >> > > >> > be a bit more difficult. > > >> > > >> Looks good to me. I'll commit this change to APC when you commit it: > > >> > > >> Index: apc_zend.c > > >> =================================================================== > > >> --- apc_zend.c (revision 328577) > > >> +++ apc_zend.c (working copy) > > >> @@ -48,7 +48,11 @@ > > >> > > >> static opcode_handler_t *apc_original_opcode_handlers; > > >> static opcode_handler_t > apc_opcode_handlers[APC_OPCODE_HANDLER_COUNT]; > > >> > > >> +#if PHP_MAJOR_VERSION >= 6 || PHP_MAJOR_VERSION == 5 && > > >> PHP_MINOR_VERSION >= 5 > > >> +#define APC_EX_T(offset) > (*EX_TMP_VAR(execute_data, > > >> offset)) > > >> +#else > > >> > > >> #define APC_EX_T(offset) (*(temp_variable > > >> > > >> *)((char*)execute_data->Ts + offset)) > > >> +#endif > > >> > > >> And there are a couple of extensions that are going to need similar > > >> changes because of this. pecl/optimizer, pecl/inclued, pecl/xhprof, > > >> pecl/operator and xdebug from a quick check. > > >> > > >> -Rasmus > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --20cf3033463fc226ac04cff2b1e8--