What I mean is whether writing something code in a file and then writing a require to it somewhere else is slower than writing the code in the file itself? (What about a require to a file that only has a require?)
Asked
Active
Viewed 449 times
0
-
possible duplicate of [Why is require_once so bad to use?](http://stackoverflow.com/questions/186338/why-is-require-once-so-bad-to-use) – Gordon Sep 28 '11 at 14:26
-
possible duplicate of [Breaking up a page and use require in PHP](http://stackoverflow.com/questions/7008303/breaking-up-a-page-and-use-require-in-php) – hakre Sep 28 '11 at 14:28
-
1Unless you're running a facebook-sized operation, you are NOT going to notice any difference in load times between a single monolithic file or multiple include()'d files. – Marc B Sep 28 '11 at 14:36
3 Answers
4
Yes, it's slower, but not by any magnitude of which you should care unless you encounter problems. This is called premature optimization. It's bad. Instead, spend your time making a great app and use all the tools at your disposition. If one day it runs a bit slow, you can start looking for the bottleneck and speed it up, but until then, don't worry about it.

Alex Turpin
- 46,743
- 23
- 113
- 145
-
Not sure about my phrasing for the first sentence in there, not a native speaker. If anyone wants to edit some clarity into it, be my guest. – Alex Turpin Sep 28 '11 at 14:25
0
Its negligible. But it doesn't slow down the code to a reasonable amount. Unless you're using require_once which can significantly slow down a large scale app

Mob
- 10,958
- 6
- 41
- 58