I've run few benchmarks, to measure the performance penalty of this proposal.


https://gist.github.com/dstogov/b9fc0fdccfb8bf7bae121ce3d3ff1db1


In most cases real-life apps become ~1% slower. In the worst case, I got 6% 
slowdown (on mediawiki).


Thanks. Dmitry.

________________________________
From: Zeev Suraski <vsura...@gmail.com>
Sent: Thursday, July 19, 2018 11:52:37 AM
To: Nikita Popov
Cc: Zeev Suraski; Internals
Subject: Re: [PHP-DEV] Re: [RFC] Typed Properties

On Tue, Jul 17, 2018 at 9:02 PM Nikita Popov <nikita....@gmail.com> wrote:

>
> Sure, we can wait another week. Unless the additional discussion results in
> major changes to the RFC, we'll start voting next Monday (2018-07-23). In
> the interest of avoiding further delays, please try to view this as a hard
> deadline: If you would like to discuss some aspect of the proposal or raise
> a concern, please do so now rather than on Monday morning.
>

I reviewed the proposal in detail - and quite detailed it is.  It seems
like you and Bob did a very thorough job here, kudos on that.

I do have 3 comments - none of them major - but I think should be addressed
nonetheless:

1. The RFC is surprisingly sparse on examples where the typed properties
are not scalar ones.  So much, in fact, that I had to check whether this is
intentional (i.e., classes are unsupported as enforced property types) or
an oversight.  Reviewing the 'Supported Types' section, while mentioning a
ClassOrInterface - isn't entirely clear, as it's unclear whether this is a
token, or something that stands for any class name or interface.
Thankfully the proposal does cover class and interface names as property
type definitions.  I would recommend to be explicit here, and say "any
class or interface name", and ideally also provide a sample of that option
in the Introduction section of the RFC.
2.  While trying to understand whether #1 was in fact supported and
reviewing the patch, I noticed that there were several comments from Dmitry
on the patch (within the pull request).  It would be nice if they were
addressed (none of them will turn the patch upside down, and as I see it
they are orthogonal to the vote).
3. The patch does bring a performance penalty, albeit quite small (every
property assignment now has to conduct type safety checks).  This does not
only affect code that uses typed properties - but also code that doesn't.
I think this should be mentioned in the RFC.  To be clear - I don't think
the penalty is substantial enough to change someone's opinion about the
merits of the proposal one way or another - but in the spirit of full
disclosure it should be there.

Zeev

Reply via email to