php / php-src

The PHP Interpreter
https://www.php.net
Other
38.1k stars 7.74k forks source link

Opcache to AST reversion ? #9682

Closed kmirea closed 2 years ago

kmirea commented 2 years ago

Description

Sidenote Q: Is there any possibility of or attempts made at reversion of compiled/cached globals back into AST statements ? is manual (re) construction the only way ? I ask this in the context of a situation where you have opcached files whith frequent revisions, and attempting to avoid having to replace them and recompile adnausium.

Appreciate avery one of you, and am counting the days now till all those who have sccoffed at the idea of php in the past, slink their way back hoping noone will notice

Best Wishes <3

kallesommernielsen commented 2 years ago

Sounds like you are interested in match: https://www.php.net/match

iluuu1994 commented 2 years ago

@kmirea Please create new issues instead of changing the descriptions of existing ones to avoid confusion.

Opcache's philosophy is that source files shouldn't change frequently. The cache is "add only". Scripts can only be marked as invalidated but not be removed from the cache, so they are essentially "dead weight" taking up space in the cache. If the cache fills up completely Opcache will trigger a restart which is incredibly expensive as every script will need to be recompiled. This can lead to cache stampede.

So, for scripts that change frequently, you might want to consider not caching them at all by putting them in the opcache blacklist.