php - How file size affect performance? -


I need some explanation on the performance of a website. Let's assume that the server configuration is optimized and it is the same, just file size Think about the numbers.

  1. How does the file size affect website performance?

    Let's say we have 10000 lines and it has 50 lines. We are only calling that function

    With this ceremony, another file with 50 lines alone.

    1. If we execute both files, then will the small file be faster or both execute evenly?
    2. Why are we trying to reduce the line of code?

      Assume that the server has 1000 files. We are only using 2 files. There are only 2 files in another server. Can there be a difference between these 2 server file execution?

      I am using PHP but the question is normal

      This is nothing like this That can be answered with yes or no You have to benchmark how many requests / your app can handle to look at others. My feedback is that the difference is smaller than the configuredly configured server.

      If you use something like APC, files are parsed once and stored in memory, at that time, delivery of code lines is hardly relevant.

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

      • File I / O time one Accessing a large file can slow access to many smaller files.

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

        But then, as most people will tell you, you probably do not have to worry about it. And you certainly should not worry about it if you can not prove that it is a problem of benchmark and profiling tests.

Comments