Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102643 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80894 invoked from network); 7 Jul 2018 23:49:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Jul 2018 23:49:52 -0000 Authentication-Results: pb1.pair.com header.from=mdwheele@ncsu.edu; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=mdwheele@ncsu.edu; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain ncsu.edu from 209.85.218.45 cause and error) X-PHP-List-Original-Sender: mdwheele@ncsu.edu X-Host-Fingerprint: 209.85.218.45 mail-oi0-f45.google.com Received: from [209.85.218.45] ([209.85.218.45:38645] helo=mail-oi0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 84/C6-55607-F91514B5 for ; Sat, 07 Jul 2018 19:49:51 -0400 Received: by mail-oi0-f45.google.com with SMTP id v8-v6so29868393oie.5 for ; Sat, 07 Jul 2018 16:49:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ncsu.edu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LwKRx8cc9sXyqY5QrQ5YsZY1nk0ZFbqUYme2D4W6iIY=; b=GWhs4fh5VaxRP4cELalxBA/amMPbhPkEyTUJLS61PzcNikc8iDBwpeKiqqqHtR1LK4 +GQuFWdpxklhj5xo3LONk0urlcj1BGOuDO+CtT3NdXkwXNAAotJPHz03NopjcQIEEW5X 9Z+Nn5VyvyyUGNCRC4jKD29KQDhh3E/SWCBw/Rt8p6QednzcYvlCfQouUx9sRAEj+xWn w3C///hWuvbDtntJ92Kuu07pH3N3rn3CGm2FGMKcwm0wF/FbXW98ptNb0QXbm+2CTqSo 57J3iVezoEq4KFx7FlPn089NOZdIs4ZBLuH0F6GqLLCSUJh0eYPyCFluLuMSSCA3N+PG 9tRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LwKRx8cc9sXyqY5QrQ5YsZY1nk0ZFbqUYme2D4W6iIY=; b=Yl3p5akQvAZMgefa79zgiuaqPL0Lx7YscQKIydyvyt6oQAuYdI0XBiCVneACt3CfSm gEs/KX1I1FjCe1p8yf9fub68N0g3atCky+6kte3XhKdy6Z2vrm90yLTSV/mfQb0Np4H+ xlROGd70vjD9JHGPTXNZjMQwdtL0UrzZnNFeczKrw7hxJXP4rqi28iWqLXdElwjIr24D kn0fWs96/RV/rNZF3H+cgD+mYBdaF2jiU5uSgOWx0uyGCulWcc0nNAb7Dcd0pYOYlqkw 43z0q+qqNWgbPbDxeos3X5qKPWs7WPssrMT7Qf4k2/Xb6l3Jsa5K8F2QMDKZbHSGJbCu 9Fbg== X-Gm-Message-State: APt69E0gy1+QPHVNXuGX6ZM8/YfLx9dnl69zph8lJXhwT8eiUqXBbcvi 2yBQdpCwFz+glkA1ohGGH4NbizWeStXvFyOb1FWJamnnWFg= X-Google-Smtp-Source: AAOMgpfaBqL3rhpXzQKvy1dJDDXBRWveAFW5ZIpmct/wkOaB03BvdfINA8f9EAt/BAh/XS9TVjJ6y944ABIpBPxj0i8= X-Received: by 2002:aca:d5d3:: with SMTP id m202-v6mr8111551oig.93.1531007387784; Sat, 07 Jul 2018 16:49:47 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sat, 7 Jul 2018 19:49:36 -0400 Message-ID: To: yohgaki@ohgaki.net Cc: PHP internals Content-Type: multipart/alternative; boundary="0000000000007f8e630570716f81" Subject: Re: [PHP-DEV] [RFC] [VOTE] Class Friendship From: mdwheele@ncsu.edu (Dustin Wheeler) --0000000000007f8e630570716f81 Content-Type: text/plain; charset="UTF-8" On Sat, Jul 7, 2018 at 6:46 PM Yasuo Ohgaki wrote: > > I would like to vote to "yes". > However, RFC does not have benchmark result. Do you have some results? > > Regards, > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net > > I have not run a benchmark on the current implementation but would be happy to (and also attach that to the results of the RFC, pass or fail). Since there really isn't a good way to test this exact behaviour against master (since it doesn't exist), do you have any ideas for a reasonable benchmark? The only added clock time should be attaching "friended" classes to the "friending" zend_class_entry and an additional runtime check for `protected` member access. What about the following: For master (control): ``` class Readable { public $property = 'foo'; } class Reader { public function read(Readable $object) { echo $object->property; } } $readable = new Readable(); $reader = new Reader(); // Time the following... for ($i = 0; $i < 10000; $i++) { $reader->read($readable); } ``` For RFC (experiment): ``` class NotReadable { friend Reader; protected $property = 'foo'; } class Reader { public function read(NotReadable $object) { echo $object->property; } } $not_readable = new NotReadable(); $reader = new Reader(); // Time the following... for ($i = 0; $i < 10000; $i++) { $reader->read($not_readable); } ``` If you have any better idea, let me know and I can move forward. Also, if there is some "standard" benchmark you'd like me to run, please let me know. Thanks! -- Dustin Wheeler | Software Developer NC State University mdwheele@ncsu.edu "If you don't know where you're going, it's easy to iteratively not get there." --0000000000007f8e630570716f81--