Apparently, with gdc and optimizations turned on, the test in question
is optimized enough that the first function being benchmarked sometimes
takes no time at all (since the function being benchmarked does
nothing), causing the test to fail. This fixes that.
This should make it clearer how to deal with the problems created by
having deprecated symbols in std.datetime.package that conflict with the
ones in std.datetime.stopwatch.
std.datetime.package has StopWatch, benchmark, comparingBenchmark, and
measureTime, all of which use TickDuration (which would be deprecated,
but it can't be deprecated as long as those functions in std.datetime
are deprecated). This commit introduces
std.datetime.stopwatch to replace those functions in std.datetime. In
order to avoid symbol conflicts, std.datetime.stopwatch will not be
publicly import in std.datetime.package until the old symbols have been
removed.
std.datetime.experimental.stopwatch contains StopWatch and benchmark
which have essentially the same APIs as the ones in
std.datetime.package, but they use MonoTime and Duration.
comparingBenchmark has not been ported to MonoTime and Duration, because
it is simply a wrapper around benchmark.
measureTime has not been ported to MonoTime and Duration, because it is
equivalent to using StopWatch with a scope(exit) statement.
The old functionality will be deprecated the major release after the new
symbols have been introduced.