Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92101 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56636 invoked from network); 5 Apr 2016 12:32:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Apr 2016 12:32:29 -0000 Authentication-Results: pb1.pair.com smtp.mail=pthreads@pthreads.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=pthreads@pthreads.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pthreads.org from 209.85.161.179 cause and error) X-PHP-List-Original-Sender: pthreads@pthreads.org X-Host-Fingerprint: 209.85.161.179 mail-yw0-f179.google.com Received: from [209.85.161.179] ([209.85.161.179:33665] helo=mail-yw0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9A/75-27948-B50B3075 for ; Tue, 05 Apr 2016 08:32:27 -0400 Received: by mail-yw0-f179.google.com with SMTP id t10so14225133ywa.0 for ; Tue, 05 Apr 2016 05:32:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pthreads-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=Iz/roirTzirOComfVKi0MNzJWJbMcnYdGBeYFlUXPoc=; b=wGFjyUaMuim/kCFmtVj7gS23erotX1M2Xs3/zA4YsBVaWcgMS0Hr3Bu6BW/Oq5jQn6 H5XGXvbKMq6Q0++/Db6zGF9du7p4QMBuy8m23/zNt8+8xfoFEcsrTgTDxUKjtsefQwrZ vTtYci3o1/nn4A6rUnTgumzD1bjlll8jpzDOVvLY0Q4uwogeCzlQ+b9/yBrYsKFd2XIl UFn1EHivgVZ9ZEis1NfxsqNn+RCJnOWPxrdqhJENPm5mhdYkJlZsbpq9Mkk8srJbW3F5 oMBYVeIlAvKJJPCYgKjmlDkaRSEJCu0mS1SL+C9zVARHV7nZCHyLmuw4L3vjCIKrxfR4 GeCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=Iz/roirTzirOComfVKi0MNzJWJbMcnYdGBeYFlUXPoc=; b=Tk6Cm2wW14EuwDRbS5iCyrYvHQjl7MOYeyBTepjfIktCAN60GsM4kpNP+CuEKGiYfo PaiH3E0Yp1H3VEdgsZvzdLi0Vb5nzeDlAbQgyGIir1ETR9uBva8yWNnRFk5s5l1slLZs XJSdm/B8LohgxPKtx/bdhQoVxr+bJINFg0/lCjnS8CUJSbOnBaYYP3eSOw6ZQXM15N6J TOU50csCkLhKUJ6lnYNtDNSBMc/1facfWiFHBNAEkTKadVh919N4BkIgMvQd2RVAhqhn 4u6ogL7iZ2/IU2ZaHBegAC2mII7VCTolLfHL2EkXIiQVgYLGmWZuS8iqh9mSQm+L/7pW QbjA== X-Gm-Message-State: AD7BkJI02LF8rV+8gt0NGEaQaFzaqLkAp1wVwfU/MftXXiZYWg3555JapU9MDZqUqrUUbSDJIaGrsVV4YpPurw== MIME-Version: 1.0 X-Received: by 10.37.4.197 with SMTP id 188mr4644249ybe.81.1459859544296; Tue, 05 Apr 2016 05:32:24 -0700 (PDT) Received: by 10.129.39.9 with HTTP; Tue, 5 Apr 2016 05:32:24 -0700 (PDT) X-Originating-IP: [109.159.6.57] In-Reply-To: <5703AC10.9030906@zend.com> References: <5703AC10.9030906@zend.com> Date: Tue, 5 Apr 2016 13:32:24 +0100 Message-ID: To: Dmitry Stogov Cc: Derick Rethans , Nikita Popov , Bob Weinand , Xinchen Hui , Eran Ifrah , internals Content-Type: multipart/alternative; boundary=001a11c00f788f80e7052fbc09c6 Subject: Re: [PHP-DEV] RETURN micro optimization From: pthreads@pthreads.org (Joe Watkins) --001a11c00f788f80e7052fbc09c6 Content-Type: text/plain; charset=UTF-8 Dmitry, No worries ... I had just found out it wasn't particular to phpdbg ... Cheers Joe On Tue, Apr 5, 2016 at 1:14 PM, Dmitry Stogov wrote: > > > On 04/05/2016 12:04 PM, Derick Rethans wrote: > >> On Tue, 5 Apr 2016, Dmitry Stogov wrote: >> >> I propose a micro optimization for RETURN statement. >>> >>> Currently "return $x" increments reference counter of $x, then in >>> zend_leave_helper() we perform zval_ptr_dtor() on the same $x. >>> >>> The patch sets the original value of $x to null in first place, so >>> zval_ptr_dtor() is not going to be called. >>> >>> https://gist.github.com/dstogov/36f68b206242a39691ac539c2fc85d40 >>> >>> the performance impact is invisible (0.1% less instruction retired on >>> Wordpress). >>> >>> It breaks sapi/phpdbg/tests/breakpoints_005.phpt, but this is probably >>> not a big deal. >>> >>> BTW: this change may affect debuggers in some other way. >>> >> I'd like to know why this breaks before saying something. It'd be a PITA >> if this micro optimisation wouldn't actually do a lot performance wise, >> but makes some debugging not possible. >> > Actually, the patch has a bug. > It doesn't take into account that "return $x;" might be used in global > scope. > Setting $x to NULL in this case isn't right, of course. > > Introducing another check would probably negate the effect of > micro-optimization. > > So, ignore this for now, and sorry for noise. > > Thanks. Dmitry. > > > > >> cheers, >> Derick >> > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a11c00f788f80e7052fbc09c6--