I'd throw in a request to address the following.

Suppose we have a function F and a set of inputs S that are supposedly different scenarios we optimize for. What is interesting is to benchmark all of F(S[i]) as |S| separate functions greatly saving on boilerplate (and helping readability).

One way would to allow passing in an input range of ArgumentTuples to F.

Say as prefix:

void benchmark_f(int a, double b, string s){ ... }

enum benchmark_data_f = [ tuple(1, 2.0, "hi"), tuple(2, 3.0, "bye") ];

Then in the results it'd look as:
f(1, 2.0, "hi")                <ns/iter>   <iter/s>
f(2, 3.0, "bye")               <ns/iter>   <iter/s>

Using any input range is interestingly flexible e.g. :

enum benchmark_data_x = cortesianProduct(iota(1, 3), iota(1, 3));
//we should probably have it in std.range somewhere

void benchmark_x(int a, int b){ ... }

That being said I don't really get the benefit of passing iteration count to the function being benched. To allow it to do initialization step once then do resumeBenchmark() and run some inner loop n times?

--
Dmitry Olshansky

Reply via email to