On Sat, Jul 7, 2018 at 6:46 PM Yasuo Ohgaki <yohg...@ohgaki.net> wrote:
> > I would like to vote to "yes". > However, RFC does not have benchmark result. Do you have some results? > > Regards, > > -- > Yasuo Ohgaki > yohg...@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 mdwhe...@ncsu.edu "If you don't know where you're going, it's easy to iteratively not get there."