GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Anyone know a good PHP code optimizer? (https://gfy.com/showthread.php?t=245071)

the Grandad 02-29-2004 06:20 PM

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

BradM 02-29-2004 06:23 PM

http://www.php.net/docs.php

:)

the Grandad 02-29-2004 06:27 PM

Quote:

Originally posted by BradM
http://www.php.net/docs.php

:)

hmmm Thanks but I don't fancy doing manually :1orglaugh

BradM 02-29-2004 06:29 PM

I know... Im just being a butthead.

I don't know of one... sorry but getting you a free bump.

the Grandad 02-29-2004 06:35 PM

Quote:

Originally posted by BradM
I know... Im just being a butthead.

I don't know of one... sorry but getting you a free bump.

Free Bumps always Appreciated :thumbsup

JD 02-29-2004 06:38 PM

zend optimizer

swedguy 02-29-2004 06:45 PM

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 :)

the Grandad 02-29-2004 06:46 PM

Quote:

Originally posted by SPeRMiNaToR
zend optimizer
Thanks SPeRM I'll give that a shot :thumbsup

the Grandad 02-29-2004 06:47 PM

Quote:

Originally posted by swedguy
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 :)

erm.......... OK
Thanks anyway, hehe :winkwink:

swedguy 02-29-2004 06:49 PM

If you only wanna strip comments and stuff like that. That's the easiest way :)

Lane 02-29-2004 06:52 PM

it wouldnt make any noticable difference in the performance but its your call

alan-l 02-29-2004 06:54 PM

Quote:

Originally posted by BradM
sorry but getting you a free bump.
yes, after the sig whoring madness I guess people will start to charge for bumps :Graucho

Libertine 02-29-2004 06:57 PM

Quote:

Originally posted by Lane
it wouldnt make any noticable difference in the performance but its your call
The difference in performance comes when he hires a bprogrammer to make some changes to the script :glugglug

KC 02-29-2004 07:09 PM

Quote:

Originally posted by the Grandad
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

Comments in code is one of the most valuable things a programmer can do.

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.

KC 02-29-2004 07:10 PM

Removing comments from code is a TERRIBLE idea, IMO.

Ash@phpFX 02-29-2004 08:27 PM

Quote:

Originally posted by KC


Comments in code is one of the most valuable things a programmer can do.

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.

thanks for the link, i might start compiling my scripts now, although i dont use comments most of the time, i know where and what everything is

Nathan 02-29-2004 08:36 PM

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