How file size affect performance?

前端 未结 3 741
我寻月下人不归
我寻月下人不归 2021-01-20 05:13

I need some clarification on the performance of a website.

Assume server configuration is optimised and the same, just think about file size and number.

3条回答
  •  遥遥无期
    2021-01-20 05:22

    This is not something that can be answered with a yes or no. You would have to benchmark how many requests/second your application could handle to see. My opinion is that the difference is insignificant given a properly configured server.

    If you use something like APC, the files get parsed once and stored into memory. At that point, the distribution of the lines of code is hardly relevant.

    If you are not using something like APC, then you have two main things to consider:

    • File I/O time. Accessing multiple smaller files can be slower than accessing a large file.

    • Parsing time. Parsing a large file will take more time than a small one. If you are parsing more than you need, then you are wasting time.

    But again, as most people will tell you, this is probably not something you need to worry about. And you definitely shouldn't worry about it if you cannot prove that it's a problem with benchmark and profiling tests.

提交回复
热议问题