Some useful php performance optimization

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
pjcvijay
Forum Commoner
Posts: 25
Joined: Tue Sep 09, 2008 6:12 am

Some useful php performance optimization

Post by pjcvijay »

I found some useful php performance optimization..... I hope that would help all....

http://www.hm2k.com/posts/50-php-optimi ... -revisited



Thanks,
Vijay
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Some useful php performance optimization

Post by jaoudestudios »

Very useful, thanks :)
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

Re: Some useful php performance optimization

Post by kaisellgren »

A typical "do this instead of this".

Real performance does not come from switching your prints to echoes or using ++$a instead of $a++. You should really use the ones you prefer and which are better for the case. Sometimes you need to do post-increment and sometimes pre-increment. If you do it vice versa it becomes more complicated.

Use optimizers, cache static content, make a fast HTML template system, etc and don't try to switch all double quotes to single quotes.

Btw, I once tested switching all double quotes to single quotes. I used WordPress (not 2.7) and I replaced all quotes to single ones. It was not a straight forward replacement, but anyway, I did not notice anything. The random microtime change will hide the performance "gain" I got.
Last edited by kaisellgren on Fri Jan 23, 2009 7:31 am, edited 1 time in total.
User avatar
arjan.top
Forum Contributor
Posts: 305
Joined: Sun Oct 14, 2007 4:36 am
Location: Hoče, Slovenia

Re: Some useful php performance optimization

Post by arjan.top »

they forgot to add "switch to assembly" ...

I think such "optimization tips" are stupid, nano-optimizations that does not matter
User avatar
papa
Forum Regular
Posts: 958
Joined: Wed Aug 27, 2008 3:36 am
Location: Sweden/Sthlm

Re: Some useful php performance optimization

Post by papa »

I think there was some pretty useful tips in there.

#53 should be a sticky in the php code forum :)
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

Re: Some useful php performance optimization

Post by kaisellgren »

papa wrote:I think there was some pretty useful tips in there.

#53 should be a sticky in the php code forum :)
Oh well I guess you are right.

By the way, the site is about optimization so why does it have security related topics?! 8O
User avatar
papa
Forum Regular
Posts: 958
Joined: Wed Aug 27, 2008 3:36 am
Location: Sweden/Sthlm

Re: Some useful php performance optimization

Post by papa »

kaisellgren wrote:
papa wrote:I think there was some pretty useful tips in there.

#53 should be a sticky in the php code forum :)
Oh well I guess you are right.

By the way, the site is about optimization so why does it have security related topics?! 8O
Maybe he got carried away :)
Paul Arnold
Forum Contributor
Posts: 141
Joined: Fri Jun 13, 2008 10:09 am
Location: Newcastle Upon Tyne

Re: Some useful php performance optimization

Post by Paul Arnold »

#24 An alternative caching technique when you have pages that don’t change too frequently is to cache the HTML output of your PHP pages. Try Smarty or Cache Lite. [Citation]

#33 Don’t bother using complex template systems such as Smarty, use the one that’s included in PHP already, see ob_get_contents and extract, and simply pull the data from your database. [Citation]
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

Re: Some useful php performance optimization

Post by kaisellgren »

Paul Arnold wrote:#24 An alternative caching technique when you have pages that don’t change too frequently is to cache the HTML output of your PHP pages. Try Smarty or Cache Lite. [Citation]

#33 Don’t bother using complex template systems such as Smarty, use the one that’s included in PHP already, see ob_get_contents and extract, and simply pull the data from your database. [Citation]
Haha :D
Post Reply