Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I understand there is a need of placing different categories of resources in separate folders for the sake of organization. But is there any noticeable decrease in page load speeds accompanied with it that adds up as you add more and more folders or go deeper folder within folder and so on?

share|improve this question

migrated from webapps.stackexchange.com Nov 15 '10 at 9:01

This question came from our site for power users of web applications.

    
Thanks to whoever migrated it...I had a feeling it wasn't quite fit for webapps, and had wondered whether to ask on SO instead. And had almost forgotten I was even registered here.... –  Muhammad Mussnoon Nov 15 '10 at 12:34

1 Answer 1

No. The HTTP requests are a few bytes larger because the URI is longer, but that's negligible. But it shouldn't matter whether the file is 1 directory deep or 30 directories deep. AFAIK, it's a bigger problem when a single directory contains large numbers of files in it.

share|improve this answer
    
Interesting, could you explain better: "it's a bigger problem when a single directory contains large numbers of files in it", in what way might be a problem? Thanks –  Marco Demaio Nov 15 '10 at 11:03
    
@Marco: Older filesystems are very slow in retrieving files from directories with thousands of files directly in it. And even today some operations can take a long time in directories with lots of files. See: stackoverflow.com/questions/466521/… and stackoverflow.com/questions/657488/… –  Lèse majesté Nov 15 '10 at 14:04
1  
If I'm not mistaken, it would only be a problem if you were reading directories regularly (i.e. getting the list of files in the folder through PHP or something). Filesystems have two parts: the index, which lists all filenames and where their data is, and the data section which contains the raw bytes for the files. So any URL coming in can be looked up instantly and the data returned. –  DisgruntledGoat Nov 15 '10 at 14:05
    
It depends on the filesystem, but yea most modern filesystems should allow you to fetch a specific file pretty instantaneously. But some operations requiring listing a directory, and some software are poorly optimized for searching through large directories. So it's still best to break your files into multiple directories if you have thousands of files. –  Lèse majesté Nov 15 '10 at 15:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.