Hi internals,
I've created the RFC https://wiki.php.net/rfc/opcache.no_cache to make the opcode optimizer and JIT available without opcode caching, through a new setting opcache.no_cache=1
.
So far, the feedback I've gotten is that having the ability to optimize without caching would be useful,
but that moving the optimizer into Zend is possibly a better solution.
(https://github.com/php/php-src/pull/5504 ,
announced two weeks ago in https://externals.io/message/109959
"opcache.no_cache prototype: Opcode optimization without caching")
To summarize my reasons for creating the RFC without moving the optimizer:
- Even with the optimizer moved into PHP's core,
I still think there'd be the same use case for a system ini configuration setting to disable caching.
(in designs I can imagine) - I consider this useful functionality to have, so I'd rather have a good solution than an ideal solution
that currently isn't being worked on (to my knowledge) - I'd prefer creating an RFC with small changes here.
- The discussions would be useful for future RFCs in this area.
If a viable RFC&implementation to move opcache into core is created
(and would conflict with this), I'll postpone this RFC.
Thanks,
- Tyson
I've created the RFC https://wiki.php.net/rfc/opcache.no_cache to make
the opcode optimizer and JIT available without opcode caching, through
a new settingopcache.no_cache=1
.
In my opinion, configuration names should never be "in the negative".
Instead of defaulting to opcache.no_cache=0, default to opcache.cache=1.
cheers,
Derick
--
PHP 7.4 Release Manager
Host of PHP Internals News: https://phpinternals.news
Like Xdebug? Consider supporting me: https://xdebug.org/support
https://derickrethans.nl | https://xdebug.org | https://dram.io
twitter: @derickr and @xdebug
In my opinion, configuration names should never be "in the negative".
Instead of defaulting to opcache.no_cache=0, default to opcache.cache=1.
I see your point - there are only a few negative ini names I see in phpinfo()
(disable_functions, disable_cache), and those are for lists of strings.
There's a mix of on by default and off by default in
zend.enable_gc, opcache.enable, opcache.enable_cli, opcache.enable_file_override,
enable_dl, and enable_post_data_reading.
opcache.enable_cache=1 as the default would probably be more consistent with those.
But the setting isn't actually enabling cache, it's allowing cache (i.e. opposite of disabling),
so making this "opcache.allow_cache" might be the best. I'll probably go with that.
(similar to allow_url_fopen, allow_url_include)
-
opcache.cache
could be confused with the caching strategy or the path to the cache,
or being sufficient on its own to enable caching
Thanks,
- Tyson
Hi internals,
https://wiki.php.net/rfc/opcache.no_cache has been updated.
Instead of opcache.no_cache=1, opcache.enable_cache=0 is now used to disable caching.
In the RFC, I wrote that opcache_get_status()
now includes the following new booleans
-
optimizations_enabled
, which is true if any optimization passes will get run. -
allow_cache
, which will be true if any form of opcode caching is enabled.
Maybecache_opcodes
oropcode_cache_enabled
would be a better name.
Any thoughts on whether opcache_get_status()
should be changed at all here?
It's probably possible but inconvenient to determine what's being done with extension_loaded()
and multiple calls to ini_get()
,
and the intended meaning of existing flags such as opcache_enabled
was never documented
in https://www.php.net/opcache_get_status
Any other thoughts on the RFC?
In my opinion, configuration names should never be "in the negative".
> Instead of defaulting to opcache.no_cache=0, default to opcache.cache=1.... the setting isn't actually enabling cache, it's allowing cache (i.e. opposite of disabling),
so making this "opcache.allow_cache" might be the best. I'll probably go with that.
(similar to allow_url_fopen, allow_url_include)...
opcache.cache
could be confused with the caching strategy or the path to the cache,
or being sufficient on its own to enable caching
Thanks,
- Tyson
Hi tyson,
Thanks for your RFC. As ReactPHP users this is a very welcome change. Right
now we have to enable file_cache only for the optimizations, as there's no
real benefit of the full opcache in long-running CLI apps. Having this
setting would allow us to even stop using file_cache but get the opcache
optimizations. It would be even better if these optimizations moved into
PHP Core.
Thank you!
Albert
On Thu, May 21, 2020 at 4:07 PM tyson andre tysonandre775@hotmail.com
wrote:
Hi internals,
https://wiki.php.net/rfc/opcache.no_cache has been updated.
Instead of opcache.no_cache=1, opcache.enable_cache=0 is now used to
disable caching.In the RFC, I wrote that
opcache_get_status()
now includes the following
new booleans
optimizations_enabled
, which is true if any optimization passes will
get run.allow_cache
, which will be true if any form of opcode caching is
enabled.
Maybecache_opcodes
oropcode_cache_enabled
would be a better name.Any thoughts on whether
opcache_get_status()
should be changed at all here?
It's probably possible but inconvenient to determine what's being done
withextension_loaded()
and multiple calls toini_get()
,
and the intended meaning of existing flags such asopcache_enabled
was
never documented
in https://www.php.net/opcache_get_statusAny other thoughts on the RFC?
In my opinion, configuration names should never be "in the negative".
Instead of defaulting to opcache.no_cache=0, default to
opcache.cache=1.... the setting isn't actually enabling cache, it's allowing cache (i.e.
opposite of disabling),
so making this "opcache.allow_cache" might be the best. I'll probably go
with that.
(similar to allow_url_fopen, allow_url_include)...
opcache.cache
could be confused with the caching strategy or the
path to the cache,
or being sufficient on its own to enable cachingThanks,
- Tyson
Hi internals,
If there are no unexpected issues,
then voting will start on https://wiki.php.net/rfc/opcache.no_cache in 2 days, on May 30th.
Thanks,
- Tyson