Php file size

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
bennyChidge
Forum Newbie
Posts: 17
Joined: Fri Sep 19, 2008 4:40 pm

Php file size

Post by bennyChidge »

Just a quick design question.

At what point should you become worried about the file size of your .php file?

Obviously everything small works quicker on the web and i have a site with all the usual load, css, js, images, flash, and php all adding up for one page load.

I am running a file thats starting to get quite big in my eyes (40k+) and im starting to think what is "best practice" for .php file size? hmmm actually does it matter as its just the html thats rendered and downloaded?

I come from a mobile background and do like everything to be as small as it can be - but am I worrying to much?

Ta
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Php file size

Post by josh »

The contents of the PHP code are never sent to the user, the biggest performance on the filesystem is when the hard drive has to do a lot of seeking ( ie. many # of smaller files being included ). Hard drives are better at moving one large file then many small files that equal the same size.

However, often the need to break the code down into smaller manageable parts outweighs performance issues, seeing as a 40KB file may have been a lot of code 30yrs ago but this is 2008 now :D

Granted there is definitely a reason to optimize the contents that is being sent to the client / user... but on the server side if your servers choking over 40kb it may be time to upgrade
bennyChidge
Forum Newbie
Posts: 17
Joined: Fri Sep 19, 2008 4:40 pm

Re: Php file size

Post by bennyChidge »

Cheers

No choking here just wondering if theres a point when someone says bloomin heck mate your php file is a bit big!
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Php file size

Post by Christopher »

When it causes an actual performance or maintenance problem.
(#10850)
Post Reply