On Tue, Sep 15, 2020 at 9:51 AM Benas IML wrote:
> Ah, sorry! Misread your post. Anyways, the compiler doesn't transform
> `\array_keys()` yet, so there's no optimization for that.
>
> As for other compiler optimizations, 2 that I know that the compiler does
> is:
>
> 1. Binary OP evaluation i. e
Ah, sorry! Misread your post. Anyways, the compiler doesn't transform
`\array_keys()` yet, so there's no optimization for that.
As for other compiler optimizations, 2 that I know that the compiler does
is:
1. Binary OP evaluation i. e. `2 * 2` does not yield `ZEND_ADD` opcode but
is instead compu
I wasn't proposing that my example be supported. I'm totally okay with the
fact that it doesn't. My question was about whether or not those kinds of
optimizations are documented anywhere so that developers can make sure they
don't miss out on them by not fitting the proper pattern.
On Tue, Sep 15,
Hey,
During my free time, I'm implementing that specific `array_keys`
optimization. I'm not planning on supporting cases like yours (i. e.
indirection through a variable) since there's no point in doing that. And
also, it's not feasible to support every use case. Should we also support
cases like
I brought this up on another thread, but it wasn't addressed (which is
fine, since it was somewhat off-topic). I thought it might be
worth bringing up in its own thread, though.
In the other thread, someone had mentioned the following compiler
optimization
foreach(\array_keys($arr) as $key) {
an