[PHP] Why Should I Use Zend Optimizer?
I posted this on the Zend.com forums but have not been able to get a response yet. So I decided to ask the people that know. I do not understand the need for an optimizer. What exactly is Zend Optimizer optimizing? If it is changing my code, then how about if I just learn how to code better? Is that all that Zend Optimizer is doing? Making my code better? Instead of making a program to fix all the dumb things that programmers like me do, why not show us what is not working. If post-incrementing is slower than pre-incrementing then I will just start pre-incrementing. What if I already write perfect code? Would I still benefit from having Zend Optimizer on my system? In other words, is Zend Optimizer a program designed to help poor coders have faster running code despite their lack of skill? Or is it also optimizing other things? If so, why are those things not already optimized? Can anyone help me unfold this mystery? I have read quite a bit about what Zend Optimizer is and perhaps I have missed the point. So if there is a document that explains this, please direct me to it. Thanks, Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why Should I Use Zend Optimizer?
On 27/03/06, Jonathan Duncan [EMAIL PROTECTED] wrote: I posted this on the Zend.com forums but have not been able to get a response yet. So I decided to ask the people that know. I do not understand the need for an optimizer. What exactly is Zend Optimizer optimizing? If it is changing my code, then how about if I just learn how to code better? Is that all that Zend Optimizer is doing? Making my code better? There is no good reason to use ZO unless you have bought code that requires it, and the code has been encrypted to require it. If you run your own server, you would be far better served with something to actually speed your code, like APC (http://pecl.php.net/apc) or Eaccellerator (http://eaccelerator.net/) that is a compiled-code cache. And then learn how to write good code as well. Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why Should I Use Zend Optimizer?
On 27 Mar 2006, at 17:36, Jonathan Duncan wrote: I posted this on the Zend.com forums but have not been able to get a response yet. So I decided to ask the people that know. I do not understand the need for an optimizer. What exactly is Zend Optimizer optimizing? If it is changing my code, then how about if I just learn how to code better? Is that all that Zend Optimizer is doing? Making my code better? Think of the guts of PHP (the Zend Engine) as being like a virtual computer, complete with processor. When your PHP script is run, PHP takes it and first of all it is run through a lexer which will convert all of your wonderfully human-readale code (no matter how badly written!) into tokens suitable for this virtual CPU. The tokens are then passed over to the 'parser'. The parser takes each token and generates an instruction set. This is an assembly style form of code that runs on the Zend Engine. Finally it is executed. It is this process that the Zend Optimiser (and packages like it) speed up. Typically they will compile your scripts into 'executables' (for want of a better phrase), so that each time your script is called none of that lexer/parsing stage has to happen. It just executes and returns. slight diversion This whole process, and the fact that the Zend Engine IS a Virtual Machine in its own right, is why I get annoyed at people who claim that you cannot speed-up your scripts by changing the way certain things happen. I remember somebody posted a comment to my blog once to the effect of 'you aren't coding in assembly, it makes no difference what you do!' - which is of course complete crap, because actually your code does have a very direct correlation to the efficiency of the intermediate code that is generated and executed. /slight diversion In short, Zend Optimise has *nothing* at all to do with 'making dumb programmers code better' I'm afraid. Cheers, Rich -- http://www.corephp.co.uk Zend Certified Engineer PHP Development Services -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Why Should I Use Zend Optimizer?
In short, Zend Optimise has *nothing* at all to do with 'making dumb programmers code better' I'm afraid. Cheers, Rich I'm not completely sure on this, and if it is true I don't have the links, but I think it does do one thing to make your code better. That is to use pre-increments wherever possible, since the post-increment requires the parser to store the value first then increment it (or something to that effect). But even then it's really only saving you milliseconds of processing time, which would only make a beneficial improvement on an enterprise system (million-plus hits). Other than that I haven't heard anything else. It won't clean up a whole bunch of loops to something more efficient. In response to your slight diversion YES! You are TOTALLY correct. If you write something that uses a loop inside of a loop instead of just one loop (while or for) then it's going to be slower... no matter if it's compiled beforehand or at runtime :) Ray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why Should I Use Zend Optimizer?
On 27 Mar 2006, at 19:10, [EMAIL PROTECTED] wrote: In short, Zend Optimise has *nothing* at all to do with 'making dumb programmers code better' I'm afraid. I'm not completely sure on this, and if it is true I don't have the links, but I think it does do one thing to make your code better. That is to use pre-increments wherever possible, since the post-increment requires the parser to store the value first then increment it (or something to that effect). But even then it's really only saving you milliseconds of processing time, which would only make a beneficial improvement on an enterprise system (million-plus hits). Sorry I should have been more explicit - I meant it won't re-write your actual source code for you, which I believe is what the OP thought it was supposed to do (if only!) Cheers, Rich -- http://www.corephp.co.uk Zend Certified Engineer PHP Development Services -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why Should I Use Zend Optimizer?
Richard Davey wrote: On 27 Mar 2006, at 19:10, [EMAIL PROTECTED] wrote: In short, Zend Optimise has *nothing* at all to do with 'making dumb programmers code better' I'm afraid. I'm not completely sure on this, and if it is true I don't have the links, but I think it does do one thing to make your code better. That is to use pre-increments wherever possible, since the post-increment requires the parser to store the value first then increment it (or something to that effect). But even then it's really only saving you milliseconds of processing time, which would only make a beneficial improvement on an enterprise system (million-plus hits). Sorry I should have been more explicit - I meant it won't re-write your actual source code for you, which I believe is what the OP thought it was supposed to do (if only!) Cheers, Rich Yeah; I'm still petitioning the Team daily via cron for 'make_shopping_cart(str general_business_type);' in PHP6 :D KDK -- In Boston, it is illegal to hold frog-jumping contests in nightclubs. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why Should I Use Zend Optimizer?
On Monday 27 March 2006 12:40, Richard Davey wrote: On 27 Mar 2006, at 19:10, [EMAIL PROTECTED] wrote: In short, Zend Optimise has *nothing* at all to do with 'making dumb programmers code better' I'm afraid. I'm not completely sure on this, and if it is true I don't have the links, but I think it does do one thing to make your code better. That is to use pre-increments wherever possible, since the post-increment requires the parser to store the value first then increment it (or something to that effect). But even then it's really only saving you milliseconds of processing time, which would only make a beneficial improvement on an enterprise system (million-plus hits). Sorry I should have been more explicit - I meant it won't re-write your actual source code for you, which I believe is what the OP thought it was supposed to do (if only!) Cheers, Rich -- http://www.corephp.co.uk Zend Certified Engineer PHP Development Services Still right on with the pre-compiling though ;) I find that the Optimizer has value. If you wanted to cache on top of that you could probably speed it up even further with cached responses (APC or I think Zend has one too) -- Ray Hauge Programmer/Systems Administrator American Student Loan Services www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why Should I Use Zend Optimizer?
Ray Hauge wrote: Still right on with the pre-compiling though ;) I find that the Optimizer has value. If you wanted to cache on top of that you could probably speed it up even further with cached responses (APC or I think Zend has one too) Without an opcode cache, using the optimizer is going to slow you down unless you have written some extraordinarily dumb code. Without an optimizer the compiler translates your PHP script into a set of opcodes which are passed to the executor to be executed. The optimizer inserts itself in between these two stages and does a pass across the opcodes trying to remove and possibly re-arrange things a bit to make them execute faster. But if you are not caching this optimized set of opcodes in an opcode cache, then the work to optimize the opcodes will in almost all cases far outweigh the performance benefits you might see in the executor. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php