![]() |
Anyone know a good PHP code optimizer?
that removes comments, spaces, new lines, ect....
I have a great PHP script but the Author may as well be writing novel with the amount of useless comments in it. hehe |
|
Quote:
|
I know... Im just being a butthead.
I don't know of one... sorry but getting you a free bump. |
Quote:
|
zend optimizer
|
Strip one line comments:
cat file.php | perl -pe 's/^\/\/.*$// > file2.php file2.php will now be stripped from one line comments Strip multi line comments: cat file2.pp | perl -pe '$/ = ""; s/\/\*.*?\*\///sm' > file3.php file3.php will now be without multi line comments Strip blank lines: cat file3.php | perl -pe 's/^\s+//' > file4.php file4.php will now be stripped from blank lines A quick and dirty one :) |
Quote:
|
Quote:
Thanks anyway, hehe :winkwink: |
If you only wanna strip comments and stuff like that. That's the easiest way :)
|
it wouldnt make any noticable difference in the performance but its your call
|
Quote:
|
Quote:
|
Quote:
If you're worried about them effecting the performance of the scipts, you should install a PHP accelerator such as zend's or http://www.php-accelerator.co.uk/ which is free. An accelerator will compile the script and cache it. (during the compile all of the comments are ignored) However, if your script is slow, the code is the reason and those comments will help whoever works on it next. |
Removing comments from code is a TERRIBLE idea, IMO.
|
Quote:
|
Like everyone else here mentioned, removing stuff like blank lines and comments causes almost no speedup. The parsing of the code, or rather stripping of newlines and comments BEFORE parsing the code is the fastest of all the compiling and executing processes.
I have to warn about php-accelerator. It is a third party product which does not really work all too well. At least I have experienced a lot of problems with it when we tried using it on a very high-trafficed site. If you REALLY think you need it, then get Zend Encoder and Zend Optimizer. To be honest, I doubt many here would really profit from php acceleration, since I _BET_ that 98% of all speed problems for most of you people here come from database and not from php problems. The best way to speed up scripts is to learn how to code and how to use mysql, and damn few people really know how to do those two. Sadly. |
| All times are GMT -7. The time now is 03:51 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123