[Issue 13724] std.datetime.timeIt
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Apr 1 00:36:00 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=13724
Jonathan M Davis <issues.dlang at jmdavisProg.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |issues.dlang at jmdavisProg.co
| |m
--- Comment #9 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
I'm not at all convinced that this is worth adding, but if I were to add
something like this, I would probably make it use a callback that gave the
Duration so that it would be simple to do something like turn
auto foo = doSomething(args);
into
auto foo = timeIt!(a => writefln("doSomething: %s, a))(doSomething(args));
or
void printIt(Duration d, string file = __FILE__, size_t line = __LINE__)
{
writefln("%s(%s): %s", file, line, d);
}
auto foo = timeIt!printIt(doSomething(args));
But then again, the only reason I see to have a function like this would be to
do something like print or log the results of a particular run. It certainly
isn't appropriate for benchmarking.
--
More information about the Digitalmars-d-bugs
mailing list