Re: Introducing "Array Of" RFC

From: Date: Thu, 16 Jan 2014 11:12:23 +0000
Subject: Re: Introducing "Array Of" RFC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On 16 January 2014 10:49, Matthieu Napoli <[email protected]> wrote:
> The performance penalty is the same as if you were type-checking yourself.

(Sorry if I'm stepping on your toes here Joe, since it was you who
pointed this out to me):

This is not completely true. With arrayof, there are two iterations of
the passed value - one in C and one in PHP, vs only one iteration in
the foreach/instanceof approach.

However:

- as you point out, the performance penalty for the check is
negligible if it even exists
- if you don't use the syntax there is no penalty whatsoever

so for me this is a complete non-issue. The concise syntax and strong
semantic possibilities this brings far outweigh a few microseconds of
slowdown.

Thanks, Chris


Thread (46 messages)

« previous php.internals (#71178) next »