How do you benchmark?

oddp oddp at posteo.de
Sat Jan 16 00:44:08 UTC 2021


On 15.01.21 21:26, welkam via Digitalmars-d wrote:
> Currently my benchmark game is weak. It consist of writing 
> std.datetime.stopwatch in code, time in terminal and just run executable 
> multiple times. Then eyeball the results. Im not happy with it so I want 
> to ask the D tribe of what they use? I dont want to write my own tools 
> if I dont have to.

If you're just comparing different approaches within the same program, 
then there's always 
https://dlang.org/library/std/datetime/stopwatch/benchmark.html

As simple as: auto timings = 1000.benchmark!(foo, bar, baz);


More information about the Digitalmars-d mailing list