Page 1 of 1

PHP code optimization

PostPosted: Thu Sep 10, 2009 4:49 am
by Vipindas
PHP is a very fast programming language, but there is more to optimizing PHP than just speed of code execution. A good read for programmers.
http://phplens.com/lens/php-book/optimi ... ng-php.php
http://blog.yuz5.com/optimizing-your-php-code/

Re: PHP code optimization

PostPosted: Thu Sep 10, 2009 5:37 am
by latha
The article on optimizing PHP was a good read. It touches on many factors, including techniques on how to not over optimize. Everyone's been guilty of this once in a while and one of the best ways is to measure the response times, and have 2 pieces of code written for time intensive ones. A few milliseconds saved is worth a lot.

Eyeopener article to server side issues and sometimes as they say it is better to de normalize your database than to normalise.

Shared and sites hosted by thrid part people have to be reconsidered for database intensive codes.

Good ideas to munch on.

Re: PHP code optimization

PostPosted: Thu Sep 10, 2009 10:47 am
by Mike
Re: PHP code optimization
On Thu Sep 10, 2009 latha wrote:

> Eyeopener article to server side issues and sometimes as they say it is better to
> de normalize your database than to normalise.

I made a comment once on a presentation made by Cal Henderson, the developer who conceived of and designed Flickr. In the presentation he said:

"Database normalization is for sissies"

Cal Henderson found about about my comment and sent me an autographed copy of his book Building Scalable Websites



He attached a hand-written note to the inside cover, changing his rule of "Database normalization is for sissies" to:

"Normalize First, Then Selective De-Normalize"

This is a rule I follow very strictly. But that said, I have no fear of denormalizing a database structure if it makes sense. Our Wyseguyz team has just started making database schemas and design a part of our documentation and QA process - the reason being of course that database design can be very impactful on the performance of any application.

His book, by the way, is an excellent read.

Mike

Re: PHP code optimization

PostPosted: Thu Sep 10, 2009 12:13 pm
by jay
Good read and it does bothers us on how a simple change in code can effect the performance of the server.

Many factors need to be considered regarding optmization of php codes like how to avoid unwanted file loading, strip database and class loading if it's for static pages, using of echo instead of print etc...etc..

code optimization is not just about writing code but includes other factors such as planning, educating the developers of full functionality, preparation of entity-relationship diagram etc.

Even though lots of optimized open source frameworks are available it's a good practice to check whether it suits our application.

Re: PHP code optimization

PostPosted: Thu Sep 10, 2009 10:05 pm
by latha

Re: PHP code optimization

PostPosted: Thu Sep 10, 2009 10:18 pm
by latha

Re: PHP code optimization

PostPosted: Fri Sep 11, 2009 4:43 am
by douglas
Really optimization matters when it comes to Software Development. It may be Desktop Application, Client Server Application or Web Application. In earlier days it has given much importance to normalization for desktop and client server applications where database connectivity was not much important issue. In case of web applications engineers are not giving more importance for NORMALIZATION because it affects performance in low connection speed.

Most of the persons who doing web applications are not well aware of normalization because they used to do things like that. For a better control over the backend side, my suggestion is, we should normalize the database a minimum of 3rd Normal Form first and if needed, denormalize it again for the sake of performance aspects since the storage is not a constraint now a days.

Happy to see that people started talking about optimization, normalization, performance tuning, documentation etc.

Re: PHP code optimization

PostPosted: Fri Sep 11, 2009 7:08 am
by Vipindas
Was wondering what actually normalization refers to. :roll: Here are some links for those who want to know more about Normalizing database.
http://databases.about.com/od/specificp ... zation.htm
http://www.devshed.com/c/a/Administrati ... alization/
http://en.wikipedia.org/wiki/Database_normalization