Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 02-29-2004, 06:20 PM   #1
the Grandad
Confirmed User
 
Join Date: Aug 2003
Location: the Retirement Home (Almost)
Posts: 1,038
:mad 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
__________________
The Oldest Pimp in Town
the Grandad is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-29-2004, 06:23 PM   #2
BradM
Confirmed User
 
Join Date: Dec 2003
Location: 1123,6536,5231
Posts: 3,397
http://www.php.net/docs.php

BradM is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-29-2004, 06:27 PM   #3
the Grandad
Confirmed User
 
Join Date: Aug 2003
Location: the Retirement Home (Almost)
Posts: 1,038
Quote:
Originally posted by BradM
http://www.php.net/docs.php

hmmm Thanks but I don't fancy doing manually
__________________
The Oldest Pimp in Town
the Grandad is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-29-2004, 06:29 PM   #4
BradM
Confirmed User
 
Join Date: Dec 2003
Location: 1123,6536,5231
Posts: 3,397
I know... Im just being a butthead.

I don't know of one... sorry but getting you a free bump.
BradM is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-29-2004, 06:35 PM   #5
the Grandad
Confirmed User
 
Join Date: Aug 2003
Location: the Retirement Home (Almost)
Posts: 1,038
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
__________________
The Oldest Pimp in Town
the Grandad is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-29-2004, 06:38 PM   #6
JD
Too lazy to set a custom title
 
Industry Role:
Join Date: Sep 2003
Posts: 22,651
zend optimizer
JD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-29-2004, 06:45 PM   #7
swedguy
Confirmed User
 
Industry Role:
Join Date: Jan 2002
Posts: 7,981
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
swedguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-29-2004, 06:46 PM   #8
the Grandad
Confirmed User
 
Join Date: Aug 2003
Location: the Retirement Home (Almost)
Posts: 1,038
Quote:
Originally posted by SPeRMiNaToR
zend optimizer
Thanks SPeRM I'll give that a shot
__________________
The Oldest Pimp in Town
the Grandad is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-29-2004, 06:47 PM   #9
the Grandad
Confirmed User
 
Join Date: Aug 2003
Location: the Retirement Home (Almost)
Posts: 1,038
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
__________________
The Oldest Pimp in Town
the Grandad is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-29-2004, 06:49 PM   #10
swedguy
Confirmed User
 
Industry Role:
Join Date: Jan 2002
Posts: 7,981
If you only wanna strip comments and stuff like that. That's the easiest way
swedguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-29-2004, 06:52 PM   #11
Lane
Will code for food...
 
Join Date: Apr 2001
Location: Buckeye, AZ
Posts: 8,496
it wouldnt make any noticable difference in the performance but its your call
__________________
Lane is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-29-2004, 06:54 PM   #12
alan-l
Confirmed User
 
Join Date: May 2003
Location: look behind you
Posts: 2,477
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
alan-l is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-29-2004, 06:57 PM   #13
Libertine
sex dwarf
 
Libertine's Avatar
 
Join Date: May 2002
Posts: 17,860
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
__________________
/(bb|[^b]{2})/
Libertine is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-29-2004, 07:09 PM   #14
KC
Confirmed User
 
Industry Role:
Join Date: Jan 1995
Posts: 2,417
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.
__________________

Jupiter Hosting, Inc.
Vice President, Business Development
kc (AT) jupiterhosting.com
KC is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-29-2004, 07:10 PM   #15
KC
Confirmed User
 
Industry Role:
Join Date: Jan 1995
Posts: 2,417
Removing comments from code is a TERRIBLE idea, IMO.
__________________

Jupiter Hosting, Inc.
Vice President, Business Development
kc (AT) jupiterhosting.com
KC is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-29-2004, 08:27 PM   #16
Ash@phpFX
Confirmed User
 
Join Date: Nov 2003
Posts: 4,292
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
Ash@phpFX is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-29-2004, 08:36 PM   #17
Nathan
Confirmed User
 
Industry Role:
Join Date: Jul 2003
Posts: 3,108
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.
__________________
"Think about it a little more and you'll agree with me, because you're smart and I'm right."
- Charlie Munger
Nathan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.