Impressed
Nick Sabalausky
SeeWebsiteToContactMe at semitwist.com
Sat Jul 28 19:08:20 PDT 2012
On Sat, 28 Jul 2012 20:32:57 +0200
"David Piepgrass" <qwertie256 at gmail.com> wrote:
> What's the easiest way to time something in D?
{
import std.datetime;
StopWatch stopWatch;
stopWatch.start();
scope(exit)
writeln(stopWatch.peek.msecs, "ms");
// Do stuff to be timed
}
Or use my verboseSection wrapper:
https://bitbucket.org/Abscissa/semitwistdtools/src/8123e04b593c/src/semitwist/util/mixins.d#cl-644
bool verbose = true;
...
{
mixin(verboseSection!"Making the fizzbar");
makeFizzbar();
}
Output:
Making the fizzbar...732ms
More information about the Digitalmars-d
mailing list