Review of Andrei's std.benchmark
Peter Alexander
peter.alexander.au at gmail.com
Wed Sep 19 01:06:20 PDT 2012
I don't see why `benchmark` takes (almost) all of its parameters
as template parameters. It looks quite odd, seems unnecessary,
and (if I'm not mistaken) makes certain use cases quite difficult.
For example, suppose I want to benchmark a function several times
with different parameters and names, how would I do that?
foreach (i; 0..10)
{
printBenchmark!( format("Test %d", i), { someFunc(i); } )();
}
This won't work because i isn't known at compile time, and for
some use cases it can't be known at compile time.
I wouldn't mind if there was some real benefit to taking these as
template arguments, but there doesn't seem to be any value at all
-- it just limits usage.
More information about the Digitalmars-d
mailing list