On Monday, 26 August 2019 at 09:14:23 UTC, Jonathan M Davis wrote:
On Sunday, August 25, 2019 11:59:08 PM MDT berni via

- Jonathan M Davis


OFFTOPIC:

(dont have ur email. dont like emails cuz too officially and too long) (and dont want create new topic. this one probably solved/finished already)

about benchmark https://dlang.org/library/std/datetime/stopwatch/benchmark.html
idk all reason why that not vice versa but imo better to change:

for now:
Duration[3] benchmark!(f1, f2, f3)( int runCount );

remarks:

benchmark!(
        // next is simple func list
        () => ps.each!( p => b += gcd( p[0], p[1])),
        () => ps.each!( p => a += divGCD( p[0], p[1])),

)( 10 ) // and here real call with complicated number

        .array // without it .map! is not compiling
        .map!( x => x.total!"msecs")
        .writeln;

1) .map! for static arrays doesn't compiling
  maybe better to return Range?

2) code with benchmark!() looks turn upside down when u try to use lambdas as args
I suggest add another versions of benchmark:
auto bench!( int N, FuncList...)( FuncList funcs );
benchmark!10( () => ps.each!( p => b += gcd( p[0], p[1])),
              () => ps.each!( p => a += divGCD( p[0], p[1])))...
auto bench!( FuncList...)( int N, FuncList funcs );
benchmark( 10,
        () => ps.each!( p => b += gcd( p[0], p[1])),
        () => ps.each!( p => a += divGCD( p[0], p[1])))...


Reply via email to