Hi! > I've seen this statement before about the impact of caching the actual > compilation (or mere tokenization?) to bytecode being very small > compared to the impact of avoiding disk access. I am curious if there > are any measurements breaking this down. Read-only access to code in > files already buffered by the OS (not files read for the first time) > ought to be very fast.
We did some measurements a long time ago at Zend, but I don't have the numbers right now and anyway the engine changed so much since then they are probably irrelevant anyway. However, the main gist is right - time saved on compilation is not that much. One of the reasons to that is that some of the data structures that are used by the engine are dynamic (class tables, class variables, static variables, etc.) which means a lot of data needs still to be handled to make script stored in SHM runnable. Which greatly decreases savings from not compiling it. The disk read however is still saved, and since unlike compilation it's a system call and talks to potentially very slow (compared to memory) device, the savings are significant. Even with OS cache, you still have context switches and copying the data, etc. With some work I think it is possible to make PHP script to run with zero system calls spent on loading script files. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php