std.benchmarking and getting rid of TickDuration

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Mon Oct 5 09:19:11 PDT 2015


On Monday, 5 October 2015 at 15:51:58 UTC, Marco Leise wrote:
> Should the examples have `pragma(inline, false)` on the 
> benchmarked functions? I'm not so worried about inlining as I 
> am about const folding the benchmarked expressions away.

I'm not sure that it's a good idea to start pasting pragmas for 
inlining all over the place rather than letting the inliner do 
its job, but regardless, there have been enough complaints about 
how pragma(inline...) is designed that I don't know if we can 
even rely on it staying the way it is right now.

> If there _was_ a review for a new module I would swamp your 
> progress with feature requests like "validation of return value 
> of benchmarked functions" or "benchmark for x seconds with y 
> iterations of the inner loop for comparing benchmarks for cases 
> where one function is orders of magnitudes faster than the 
> other". And I'm sure others have lots of ideas, too and it will 
> turn into an endless bike-shedding discussion and take another 
> 6 months to get this merged and no one wants that, right?

Andrei previously had a proposal for std.benchmark which added a 
lot more, but it died in the review process (primarily due to it 
relying on static constructors to do some of what it was doing 
IIRC). We may very well get another proposal from him or someone 
else in the future. But this PR is entirely about replacing 
existing benchmarking functions with versions that use Duration 
and MonoTime instead of TickDuration and not about adding 
functionality. Major additions like Andrei worked on before can 
go through the review process as normal, and it's certainly not 
on my todo list. I'm behind enough on that as it is. As it 
stands, the main reason that the PR creates std.benchmark is 
because the new functions cannot got in std.datetime without 
conflicting with the functions that they're replacing (though I 
do think that the benchmarking functions are better placed in 
std.benchmark anyway, and Andrei's proposal did include moving 
them there).

- Jonathan M Davis


More information about the Digitalmars-d mailing list