Mercurial > projects > dynamin
diff dynamin/core/benchmark.d @ 104:5c8c1c2e12c0
Change from real to double.
double is not dependant on the platform, and it uses less space.
author | Jordan Miner <jminer7@gmail.com> |
---|---|
date | Fri, 06 Jul 2012 18:39:45 -0500 |
parents | 73060bc3f004 |
children | acdbb30fee7e |
line wrap: on
line diff
--- a/dynamin/core/benchmark.d Tue May 15 22:06:02 2012 -0500 +++ b/dynamin/core/benchmark.d Fri Jul 06 18:39:45 2012 -0500 @@ -18,24 +18,24 @@ * Returns: The average number of milliseconds one call of the specified * delegate took. */ -real benchmark(int repetitions, void delegate() dg) { // use static opCall()? +double benchmark(int repetitions, void delegate() dg) { // use static opCall()? long time = Environment.runningTime; for(int i = 0; i < repetitions; ++i) dg(); - return (Environment.runningTime-time)/cast(real)repetitions; + return (Environment.runningTime-time)/cast(double)repetitions; } -real benchmark(void delegate() dg) { +double benchmark(void delegate() dg) { return benchmark(1, dg); } /** * name can be null */ -real benchmarkAndWrite(string name, int repetitions, void delegate() dg) { - real time = benchmark(repetitions, dg); +double benchmarkAndWrite(string name, int repetitions, void delegate() dg) { + double time = benchmark(repetitions, dg); Stdout.format("{} took {:.2}ms.", name, time).newline; // TODO: verify :.2 return time; } -real benchmarkAndWrite(string name, void delegate() dg) { +double benchmarkAndWrite(string name, void delegate() dg) { return benchmarkAndWrite(name, 1, dg); }