On 11/29/12 10:54 AM, Dmitry Olshansky wrote:
Basically there is this pattern:
module a;
...
mixin ScheduleForBenchmark;
Same for module b, c, d...
Correct.
And then compiling all of this with -version benchmark should run the
benchmarks.
It already has another problem: there has to be D main stuffed in there
somehow. It can't be in std.benchmark as it then will have to be
included in phobos(.lib|.a) and it can't be magically turned on/off with
-version switch either unless std.benchmark is passed directly to the
compiler.
The other solution would be: make a separate my_benchmark.d module that
contains:
import a,b,c,d...;
void main(){
runBenchmarks!(a,b,c,d...)();
}
That's workable. I'm hoping, however, to make benchmarks as easy and as
trivial to define as unittests.
Andrei