开发者

Does require in PHP slow the site down?

开发者 https://www.devze.com 2023-04-08 02:37 出处:网络
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 req开发者_JAVA技巧uire to a fi

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 req开发者_JAVA技巧uire to a file that only has a require?)


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.


It will take time to stream the file in, but its very trivial.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号