6 ms·
Imports are also updated the moment you update the imported file. I'm not sure if PHP stores any compiled binary or byte-code at all. Maybe it compiles it all
by JonathanBeuys 3y ago
Imports are also updated the moment you update the imported file.
I'm not sure if PHP stores any compiled binary or byte-code at all. Maybe it compiles it all on each request. It's super fast though, even with tons of imports.
My guess would be that it keeps compiled versions of each file in memory and on each request, it walks down the whole import path. And when it encounters a changed import, it compiles only that one.
Would be cool if someone with more knowledge could shed a light on what is actually happening.
- dsego 3y agoAfaik, PHP can have opcode caching enabled or disabled.
- JonathanBeuys 3y agoTrue. I see a "Zend OPcache" section in my phpinfo(). It says: Cache hits 4746528 Cache misses 38875 Both values go up every time I execute phpinfo(). I wonder why. Shouldn't "Cache misses" only go up when a source file is changed?
- raziel2p 3y agoAFAIK, before PHP even accesses opcache for bytecode, it checks the file's metadata (last modified, most likely). So an updated file might never trigger a cache hit or miss.
- JonathanBeuys 3y agoIf it does not access the opcache, against what is it checking the last modified date?