On Mon, Aug 31, 2020 at 10:35 AM David Rodrigues <david.pro...@gmail.com>
wrote:
>> It should be possible for the engine (at some layer) to look at that
closure
>> and see that it's just negating some proxied call and elide setting up
the
>> intermediate frame.  Microoptimizations SHOULD be the engine's job, not
userspace's.
>>
>
> I really think that it should be a good solution, but how hard should it
be to create a proxy like that?
>

We already have a few examples of proxies of this sort.
Closure::fromCallable() comes to mind in particular.  We could detect the
`fn($x) => !y($x)` pattern and replace it with a callable of y with
negation (and a few other common idioms).

I wouldn't vote against a flag on array_filter(), because doing the quick
and easy thing is very much in PHP's DNA, but I think we can cover a lot
more ground with a more general purpose solution that leaves userspace to
deal with bigger problems.

-Sara

Reply via email to