www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - How do you benchmark?

reply welkam <wwwelkam gmail.com> writes:
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.
Jan 15 2021
next sibling parent Max Haughton <maxhaton gmail.com> writes:
On Friday, 15 January 2021 at 20:26:22 UTC, welkam 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.
https://code.dlang.org/packages/chimpfella I use my own library for it. The dub version should be up to date and working although it's a bit rough around the edges. Basically write a benchmark, then the library takes a range to generate a parameter to measure over.
Jan 15 2021
prev sibling next sibling parent drug <drug2004 bk.ru> writes:
On Friday, 15 January 2021 at 20:26:22 UTC, welkam 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.
Take a look into at https://dlang.org/blog/2020/03/13/tracing-d-applications/
Jan 15 2021
prev sibling parent reply oddp <oddp posteo.de> writes:
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);
Jan 15 2021
parent Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Saturday, 16 January 2021 at 00:44:08 UTC, oddp wrote:
 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);
+1 for benchmark, simple as can be really.
Jan 16 2021