Benchmark extension


Is there a standard way to benchmark the code? Tired of

$start = time();

// do something

print time()-$start;


Is this what you want?

Nope. It just outputs two timestamps, at start and end points. I need something robust yet simple to use and, ideally, served as app logic logging :)

Something like in the following pseudo code:

start_benchmark("Big Chank");

benchmark("op #1")

// lengthy op


  benchmark("op in a loop")

  // heavy stuff



and the expected output should be:

Big Chank started at 12:34

2.318s op #1

100 times "op in a loop": 0.15s average

Big Chank finished in 1m 54s

Hopefully, that’s more clear of what I want. Am I asking too much?


Just made an extension - Benchmark. It does exactly that I was asking for, and a bit more :slight_smile:

It even supports continuous logging in forked kids. I’m working on the extensive description, but since the source code is well commented and a unit test is included, it should be very easy to figure out how to use it.