PHP code optimization

Programming for Search Engines 101. An area for avid PHP and .NET developers to chat about Programming techniques and how to make better use of search engines.

Moderator: Moderators

PHP code optimization

Postby Vipindas » Thu Sep 10, 2009 4:49 am

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/
Known is a drop..Unknown is an Ocean.
Vipindas
 
Posts: 24
Joined: Thu Aug 07, 2008 10:34 pm

Re: PHP code optimization

Postby latha » Thu Sep 10, 2009 5:37 am

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.
latha
 

Re: PHP code optimization

Postby Mike » Thu Sep 10, 2009 10:47 am

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
Mike
 

Re: PHP code optimization

Postby jay » Thu Sep 10, 2009 12:13 pm

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.
Jay M
Write Less, Do More
jay
 
Posts: 475
Joined: Wed Nov 22, 2006 12:05 am
Location: Cochin, India.

Re: PHP code optimization

Postby latha » Thu Sep 10, 2009 10:05 pm

latha
 

Re: PHP code optimization

Postby latha » Thu Sep 10, 2009 10:18 pm

latha
 

Re: PHP code optimization

Postby douglas » Fri Sep 11, 2009 4:43 am

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.
douglas
 
Posts: 282
Joined: Fri Feb 20, 2009 3:56 am

Re: PHP code optimization

Postby Vipindas » Fri Sep 11, 2009 7:08 am

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
Known is a drop..Unknown is an Ocean.
Vipindas
 
Posts: 24
Joined: Thu Aug 07, 2008 10:34 pm


Return to Programming

Who is online

Users browsing this forum: No registered users and 4 guests