How much each function "costs" to the server

1

My question is regarding the is_dir function to check for a directory.

How much does it cost to use this function?

How to measure the use of this or another function in PHP?

The file_exists function, for example, says it costs 12 times more to load a simple application.

    
asked by anonymous 27.03.2018 / 05:04

1 answer

3

We can not know.

Time depends on the capacity of the equipment and other configuration factors. This always considering the same conditions.

Depends on the conditions you are currently running. Things are not as linear as you might think.

And it depends where it's being applied. With different data the time will be different.

Measuring the time of a function is a bit tricky, especially on a loaded server and web application. What to measure in one situation may not be reproduced in another.

As far as I know PHP does not even provide adequate tools to measure well running under these circumstances. It is likely to have something more advanced, perhaps from third parties that will facilitate verification.

And will measure for what? You have to have a goal. Knowing the information will do what with it?

The final paragraph says something that does not seem to make much sense, I can not imagine what the call of that function has to do with the application load and where that number comes from.

    
27.03.2018 / 05:13