Google PHP performance tips

2 commentaires

I think I've never been retweeted that much so quickly. I just bookmarked using my old delicious account, a post from google with a few tips to optimize your PHP scripts. You really shouldn't take them for granted (not sure that can be said, I'm just warming up with my english). At least, you should take all of them, for granted.

Upgrade your version of PHP : is this really a performance tip? Even if that's right, that's a shame if you waited google telling you this to upgrade your PHP skills. If you're still using PHP 4, please go away. Fast.

Use caching : I think the "smarty" part was a joke.

Avoid writing naive setters and getters : Even if that's probably true about some of my setters and getters, I really don't think using public variables is a good solution, you really don't know when you will have to add some tests. Not doing any tests on your variables is a really bad idea, by the way. Especially with PHP.

Avoid doing SQL queries within a loop : Before trying to build an ugly and weird SQL query, I really suggest you to take at look a SQL transactions (there, for example).

That's all folks. As I said, I'm just warming up!

Joris

I think writer didn't put the finishing touches to his article... ^^ I'm gonna delete my retweet >.<

2010-01-20 8:04 pm

Bastien

On writing getters & setters: actually, I think using only public variables is a good solution. The code is easier to maintain, and it's freakin' faster! (And it reminds me a bit of Python, even if PHP is still sucky :p)

2010-01-29 11:56 pm