Re: [RFC] [VOTE] Constant scalar expressions
Am 20.11.2013 um 21:06 schrieb Yasuo Ohgaki <yohgaki@ohgaki.net>:
> Hi Bob,
>
> On Thu, Nov 21, 2013 at 1:54 AM, Bob Weinand <bobwei9@hotmail.com> wrote:
>
>> I just have moved the RFC to vote as there was no negative feedback nor
>> unresolved issues.
>>
>> Find the vote (and the RFC) at:
>>
>> https://wiki.php.net/rfc/const_scalar_exprs#vote
>>
>> Vote will last for one week.
>>
>
> It's nice feature, but I concerned about op caching.
> Currently, const is "constant". Therefore, constant value can be cached
> (i.e. hard coded in ops)
>
> This feature seems break op caching (or close the door for constant
> optimization at least)
>
> Is this a issue? I would like hear opinions from opcache/apc developers.
>
> Regards,
>
> --
> Yasuo Ohgaki
> yohgaki@ohgaki.net
As noted in the RFC "The patch is ready to be merged. (Opcache support is included, thanks to
Dmitry)".
So, Dmitry already did the patch for opcache and I assume he has done the best possible for that.
Btw. opcache doesn't affect constants if I'm not wrong, because, what would you optimize
here (already possible):
a.php:
if ($argv[1] == "include")
include 'b.php';
const B = A;
b.php:
const A = 10;
Here we can't cache anything because the constant B depends on a conditional inclusion: same
problem.
It's that same way resolved with the current patch.
Also constant expressions (like 2+2 without constants involved) are resolved at compile time.
So I can't detect any impact related to opcache.
Bob
Thread (16 messages)