Undocumented in source.
Undocumented in source.
1 import std.meta; 2 import std.range : repeat; 3 4 auto getRandPair(T)() 5 { 6 import std.random; 7 8 struct rndParams 9 { 10 AliasSeq!(T, T) pack; 11 } 12 13 rndParams tmp; 14 auto rnd = Random(unpredictableSeed); 15 16 // Generate an integer in [0, 1023] 17 tmp.pack[0] = cast(T) uniform(0, 1024, rnd); 18 tmp.pack[1] = cast(T) uniform(0, 1024, rnd); 19 } 20 21 @FunctionBenchmark!("int add benchmark", 0.repeat(100), getRandPair!int) int add(int x, int y) 22 { 23 return x + y; 24 } 25 26 @TemplateBenchmark!(0, int, float, double) @FunctionBenchmark!( 27 "Templated add benchmark", 0.repeat(100), getRandPair) T templatedAdd(T)(T x, T y) 28 { 29 return x + y; 30 }