|
|
|
|
|
by dsp1234
3743 days ago
|
|
So you can both precompile and destroy the world with each instance. I'm pretty sure that's what PHP 5 does already with the opcache. Looking at non-jit engines, I'm more familiar with jscript/vbscript under active server pages than I am with PHP. But even that engine from 1998 caches the "compiled" bytecode of the page in a scripting engine that can be run on any thread, and can be cloned. Once the engine is finished running the current request, it drops the state from the request and awaits a new request with new state. It never destroys the scripting engine unless an actual file changes. I'm pretty sure that PHP 5.5 is similar in that regard (though I'm certainly not 100%). So when talking about 'throwing out everything' with each page load, I'm pretty sure that most people are talking about the actual state from the request, not bytecode cache. Compare this with something like nodejs where it's possible to reference a global variable from inside a request handler, and thus have a possibly hidden global dependency. Whereas with ASP/PHP, it's just not possible without making concerted efforts to call out to non-script land. Specifically, for a non-jitted language, a very reasonable concession to performance is to go ahead and force each request to run in it's own world, and then 'destroy the world', because at that point you can do huge amounts of clean up since you can make a guarantee that no other request could possibly use that request's state. |
|