Void pointers

Alex via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue May 17 00:07:27 PDT 2016


On Tuesday, 17 May 2016 at 06:55:35 UTC, Alex wrote:
>
> import std.conv : to;
> import std.datetime;
> size_t aM = 5; size_t bM = 80;
> void f1() {auto io = iota(aM,bM);}
> void f2() {auto sl = testFunc(arr, aM ,bM);}
> auto r = benchmark!(f1, f2)(100_000);
> auto f0Result = to!Duration(r[0]); // time f1 took to run 
> 10,000 times
> auto f1Result = to!Duration(r[1]); // time f2 took to run 
> 10,000 times
> writeln("f1: ", f0Result);
> writeln("f2: ", f1Result);
>
> with dmd test44.d -release
> the results are:
> f1: 692 μs and 7 hnsecs
> f2: 379 μs and 1 hnsec

testFunc is the getSlice method... sorry... and the functions are 
run 100000 times


More information about the Digitalmars-d-learn mailing list