You can do a simple profile of these metrics yourself like so:

For speed you can use microtime: https://www.php.net/manual/en/function.microtime.php

1. Store the microtime in a variable before calling your function.

2. Call your function

3. Store the micotime in anothee variable after the function call

4. Calculate a difference between the two variables to see how many microseconds the function took to run.

For Memory you can use memory_get_usage: https://www.php.net/manual/en/function.memory-get-usage.php

Repeat the process above but with memory_get_usage.

Depending on what your function does, you may also want to add some calls to memory_get_usage within the function itself and store the results in a global variable for later printing the results.

I hope this helps.

Reply to this note

Please Login to reply.

Discussion

No replies yet.