Some useful php performance optimization
Moderator: General Moderators
Some useful php performance optimization
I found some useful php performance optimization..... I hope that would help all....
http://www.hm2k.com/posts/50-php-optimi ... -revisited
Thanks,
Vijay
http://www.hm2k.com/posts/50-php-optimi ... -revisited
Thanks,
Vijay
- jaoudestudios
- DevNet Resident
- Posts: 1483
- Joined: Wed Jun 18, 2008 8:32 am
- Location: Surrey
Re: Some useful php performance optimization
Very useful, thanks 
- kaisellgren
- DevNet Resident
- Posts: 1675
- Joined: Sat Jan 07, 2006 5:52 am
- Location: Lahti, Finland.
Re: Some useful php performance optimization
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.
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.
Re: Some useful php performance optimization
they forgot to add "switch to assembly" ...
I think such "optimization tips" are stupid, nano-optimizations that does not matter
I think such "optimization tips" are stupid, nano-optimizations that does not matter
Re: Some useful php performance optimization
I think there was some pretty useful tips in there.
#53 should be a sticky in the php code forum
#53 should be a sticky in the php code forum
- kaisellgren
- DevNet Resident
- Posts: 1675
- Joined: Sat Jan 07, 2006 5:52 am
- Location: Lahti, Finland.
Re: Some useful php performance optimization
Oh well I guess you are right.papa wrote:I think there was some pretty useful tips in there.
#53 should be a sticky in the php code forum
By the way, the site is about optimization so why does it have security related topics?!
Re: Some useful php performance optimization
Maybe he got carried awaykaisellgren wrote:Oh well I guess you are right.papa wrote:I think there was some pretty useful tips in there.
#53 should be a sticky in the php code forum
By the way, the site is about optimization so why does it have security related topics?!
-
Paul Arnold
- Forum Contributor
- Posts: 141
- Joined: Fri Jun 13, 2008 10:09 am
- Location: Newcastle Upon Tyne
Re: Some useful php performance optimization
#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]
#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]
- kaisellgren
- DevNet Resident
- Posts: 1675
- Joined: Sat Jan 07, 2006 5:52 am
- Location: Lahti, Finland.
Re: Some useful php performance optimization
HahaPaul 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]