Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101346 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66971 invoked from network); 13 Dec 2017 05:02:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Dec 2017 05:02:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.220.181 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.220.181 mail-qk0-f181.google.com Received: from [209.85.220.181] ([209.85.220.181:35065] helo=mail-qk0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F8/68-53433-844B03A5 for ; Wed, 13 Dec 2017 00:02:01 -0500 Received: by mail-qk0-f181.google.com with SMTP id c13so553079qke.2 for ; Tue, 12 Dec 2017 21:02:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golemon-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=4t3Vzi6pENLamuA3Bx0ss4xXZJKzS4zxqK2m0iKbP8Q=; b=NSG93wdviKa/pjPJTFwK7G+w92EKNr2x3taKb7ZB8xDh2BGviE/wnSTudP3qDQsJLA OhGtPaIp9I4Z23sc4mVHG7bvLsQIvnPpRvsuqZ0qLpOGzoOKqTG6kFuRMk/w7NcaQTIn VXiu/GJ9bB86bHZC5bR9vp1xXFD2Vv98iZ0UXDUw4Yu7BECveJNBQEXZnyypzHE/1LXf CtJdBc73G4Pp9D43Iol1bMdlltXDElmP1fBSbWHMy9AqvBdCC9K7bHyjkygxJHnrM0MN W6KPiKKwzgSWvPOAnWr1IoL/p+U3ZbFXilKOkAIiuxnUrE0TtWWO10gyR8NO9kXft8PH C9FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=4t3Vzi6pENLamuA3Bx0ss4xXZJKzS4zxqK2m0iKbP8Q=; b=ZRS3mjwAxiv9ZUJiQCiaq9e/CVLD5LoW8O+2BzAL+cK/3v+YOmRjxbR5QIW86HeMJX j1MvoojiqEiyriKcBQr3fSCzAOznUBP9ztnIx5Png/PExLtPOV0OOGAkCXvuSBP/wDQ+ dIxg3Zt5+ExByrO7R3sOwQGEUeIvQRnH37KcgDLfHUs4O3X8Ijo0rGyx6lYe+Yk0Z5JI AiMip2EGB3ib1w5OCzrgxDH0Wqfpe7YoguKwAihgz24n8prqsOXV6q/unMMPbf9e9NFO wAjoHeUECT63X+FuCuw4iUZKQJvdBElBPnQlJb4PHF3u9lFpRCYcYq73R6VoUi8FErsN KzUQ== X-Gm-Message-State: AKGB3mINA3FlTwT18VgzImZCYymuDGrfwYUDcDxWAFsj/ZMLxb+y8bdC iIlpWEo49C1qIuSbqJLgTnp2yedhabhNACvCjiegfw== X-Google-Smtp-Source: ACJfBoudB1bNLUygz6hmN8z9uZA+U7mSKAigDkHC8w3cnMndnFnfARrYGPn6Cm9aiYGd9g7R18TjOJzhAXzvdkIc7hc= X-Received: by 10.55.207.151 with SMTP id v23mr9073879qkl.81.1513141317964; Tue, 12 Dec 2017 21:01:57 -0800 (PST) MIME-Version: 1.0 Sender: php@golemon.com Received: by 10.12.158.145 with HTTP; Tue, 12 Dec 2017 21:01:57 -0800 (PST) X-Originating-IP: [71.251.16.204] In-Reply-To: References: <1512911576.12039.8.camel@schlueters.de> <274a646a-4e56-81fe-ac52-015da2bebc6f@gmail.com> Date: Wed, 13 Dec 2017 00:01:57 -0500 X-Google-Sender-Auth: NEldLha-IPecZ1p2ItNM225v5_E Message-ID: To: =?UTF-8?Q?Johannes_Schl=C3=BCter?= Cc: Stanislav Malyshev , Nikita Popov , PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Explicit call-site send-by-ref syntax From: pollita@php.net (Sara Golemon) On Tue, Dec 12, 2017 at 2:43 AM, Johannes Schl=C3=BCter wrote: > The issue, as you well know, is that references disable copy-on-write. Th= us assume you have code like this: > > function with_ref(&$a) { > count ($a); > } > > function no_ref($a) { > count($a); > } > > The count in with_ref() will copy the array, while no_ref() can use copy = on write and won't actually copy. > That *was* true in PHP 5. In PHP 7, the with_ref() version has a very slight overhead boxing the array into an IS_REF zval, then unboxing it for the call to count(). This isn't a deep (or even shallow) copy. It's one extra zval alloc and a few integer ops. -Sara