Bruno B B Magalhães wrote: > I've installed the zend Optimizer with my Mac OS X, Apache 1.2, PHP5. > And guess what, it became about 40% slower!!! > > My framework was running for example in the modules administration > (admin area) at 0.104ms, and now the average is 0.2ms - 0.24ms > > Does anybody have any idea of what hell is this optimizer optimizing?!?1 On a very gross simplified level, the Zend optimizer works like this: When the user requests "*.php" URL: 1 Check if the page is in the cache. 2 Load the PHP script from the disk. 3 Compile the PHP script to byte-code. 4 Check for ~20 specific optimizations to alter the compilation 5 Store the byte-code in a list matching URL <-> byte-code. 6 Execute the byte-code script. The next time that URL is requested, steps 2, 3, 4, and 5 are *skipped* It simply finds the byte-code in RAM and starts executing it. Pretty much like a big fat "GOTO" to skip all those slow steps :-) Step 2 is the BIG win, actually. Hard drive slow. RAM fast. Step 3, compiling PHP to byte-code saves a bit of time to skip, but not a whole whole lot usually. Step 4 you have control over which Optimizations it does or skips. The default settings, which is probably not even to have all 20 Optimizations "on" usually works best for the "average" user, whatever that means. If the Zend Optimizer actually made your site slower, then... Perhaps you tried to set the memory size for the Optimizer really high, and you are page-faulting the cache back onto the disk. Don't do that. :-) Set your Zend memory size to something that will actually fit in RAM. More RAM + the Zend Optimizer can also make a *huge* difference if you were bordering on RAM full before. It's also possible that your scripts are triggering some particular condition among the ~20 optimizations. You can try turning them on/off one by one or in a binary search to see if it's a particular optimization. You do this in the Zend config file. It will take some time and effort to tweak and test, but it may turn out that the default settings suck for you for some odd reason, even though they're great for 99% of the users. That's why they let you change them :-) Actually, maybe start by turning off *all* Optimizations and re-testing. Right there you can determine if it's an Optimization or a RAM issue. The Zend Optimizer also comes with (or used to anyway) a feature to track the performance/pages that came out of the cache and generated some simple statistics from that to give you some idea what it was doing. Disclosure/Disclaimer: I used to work for Zend as "Vice President of Customer Support" answering questions like this. In no way, shape, or form, does that make this answer official, correct, or authoritative. :-) YMMV. NAIAA. IANAL. PS The Zend Optimizer is actually way way way more complicated than this brief description, but that's the way life goes, ya know? -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php