benchmarkSuspend

Suspends and resumes the current benchmark, respectively. This is useful if the benchmark needs to set things up before performing the measurement.

void
benchmarkSuspend
()

Examples

import std.algorithm;
void benchmark_findDouble(uint n)
{
	// Fill an array of random numbers and an array of random indexes
	benchmarkSuspend();
	auto array = new double[n];
	auto indexes = new size_t[n];
	foreach (i; 0 .. n)
	{
		array[i] = uniform(0.0, 1000.0);
		indexes[i] = uniform(0, n);
	}
	benchmarkResume();

	// The actual benchmark begins here
	foreach (i; 0 .. n)
	{
		auto balance = std.algorithm.find(array, array[indexes[i]]);
	}
}
unittest {
	TODO: writeln(benchmark!benchmark_findDouble(10_000).to!("msecs", uint));
}

Meta