static Tuple<TimeSpan, long> PerfTest(Action<long /*iterations*/> unitUnderTest)
{
long n = 100;
var sw = new StopWatch();
unitUnderTest(10); // preheat
for(;;)
{
sw.Start();
unitUnderTest(n);
sw.Stop();
if (sw.Elapsed.TotalSeconds < 1.0) {
n *= 2;
continue;
}
return Tuple.Create(sw.Elapsed, n);
}
}