Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68778 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62960 invoked from network); 31 Aug 2013 13:13:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Aug 2013 13:13:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.182 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.214.182 mail-ob0-f182.google.com Received: from [209.85.214.182] ([209.85.214.182:48268] helo=mail-ob0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DA/F0-55332-FDBE1225 for ; Sat, 31 Aug 2013 09:13:03 -0400 Received: by mail-ob0-f182.google.com with SMTP id wo10so2875425obc.41 for ; Sat, 31 Aug 2013 06:13:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=fOAAJVUP7E7f9NZPDBpactNNTmPyT92xFKyIcO9saAE=; b=t4e8C/nYAj200NcnsJDdS8iD0XQepUCI68xLutUC/D/Ydo4F0fOtBYsW1trT4f0OVr Owl+Q+EiwzVygCtQYbLbB5uso8A93/zPH92tD3OXuYPZf7cIlM+aiU1vygsPCDMCmf9T ZkUNAVofVhf6013RucfuBD3vC6/AwQrmmD1EB9CEELI1ct8iE6iHEcI9vQrZIiwdwEmG eSnwxUnh6IpPOMDfxGAYt4QQ1j3pI/rS5x7DbxgMcwKnSM6t+OyM8O7I84Db/3Zwrinm 9u+vkYnkkqJcGWxtk5GKwEcQR/sKyOO5a/NMJJiSzOWAF13obSF8y7wlkst1R0Wt36jx HLOQ== MIME-Version: 1.0 X-Received: by 10.182.87.170 with SMTP id az10mr10725750obb.10.1377954780347; Sat, 31 Aug 2013 06:13:00 -0700 (PDT) Received: by 10.182.98.8 with HTTP; Sat, 31 Aug 2013 06:13:00 -0700 (PDT) In-Reply-To: References: Date: Sat, 31 Aug 2013 15:13:00 +0200 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary=089e0111bcfa3301af04e53e194e Subject: Re: Always set return_value_ptr? From: nikita.ppv@gmail.com (Nikita Popov) --089e0111bcfa3301af04e53e194e Content-Type: text/plain; charset=ISO-8859-1 On Tue, Aug 27, 2013 at 11:40 AM, Nikita Popov wrote: > On Sat, Aug 3, 2013 at 8:16 PM, Nikita Popov wrote: > >> Hi internals! >> >> Is there any particular reason why we only pass return_value_ptr to >> internal functions if they have the ACC_RETURN_REFERENCE flag set? >> >> Why can't we always provide the retval ptr, even for functions that don't >> return by reference? This would allow returning zvals without having to >> copy them first (what RETVAL_ZVAL does). >> >> Motivation for this is the following SO question: >> http://stackoverflow.com/q/17844379/385378 >> > > Patch for this change can be found here: > https://github.com/php/php-src/pull/420 > > The patch also adds new macros to allow easy use of this feature called > RETVAL_ZVAL_FAST/RETURN_ZVAL_FAST (anyone got a better name?) > > If no one objects I'll merge this sometime soon. > Changes merged. Small benchmark to verify that this indeed avoids the copy: https://gist.github.com/nikic/6398090 :) Nikita --089e0111bcfa3301af04e53e194e--