Benchmarking

Gustavo Niemeyer gustavo.niemeyer at canonical.com
Thu Mar 14 19:12:13 UTC 2013


Greetings,

Just a quick reminder: gocheck supports benchmarks.

I've seen some timing functions being debated in reviews. While that
sounds fine, in many cases it's useful to have such time-sensitive
logic permanently benchmarked instead of a quick temporary hack to
check it out.

To add a benchmark, just replace "Test" by "Benchmark" in a gocheck
suite method name, and put the tested logic within a for loop that
looks like:

    for i := 0; i < c.N; i++ {
        // tested logic
    }

The setup/teardown functions are called as usual.


gustavo @ http://niemeyer.net



More information about the Juju-dev mailing list