0

I have always wondered this:

Does having a directory structure slow php parsing down?

admin folder:

  login folder:
      login-form.php

  pages folder:
      page-admin.php

 --OR--

admin folder:
  login-form.php
  page-admin.php

Which is faster... or does it matter?

petebolduc
  • 1,233
  • 1
  • 13
  • 20
  • 1
    I think you need to add some detail. Supposing the interpreter is only parsing one page at a time, I can't imagine that it would make a difference. And if it did, I seriously doubt it would be noticeable on any reasonable scale. – emsoff Feb 27 '14 at 18:09

2 Answers2

1

Generally: no. Any difference that may exist is so terrifically minimal that you will never ever be able to detect it.

Longer answer: it depends on the filesystem of the underlying OS. PHP itself doesn't do much with directories, all it does is pass the file path through to the OS which handles the intricacies of retrieving files by their path. This may be slightly slower if the path is deeply nested, depending on whether the filesystem looks up directories in directories one by one and reads them from disk or not. Most likely that information is simply meta data in a table in memory, which means any path is lightning fast to look up and you'll never see any difference.

deceze
  • 510,633
  • 85
  • 743
  • 889
0

Normally not, the server and the filesystem should be fast enough. This takes just a few nano- or milliseconds

best approach for file structure?

Community
  • 1
  • 1