https://issues.dlang.org/show_bug.cgi?id=13724

Jonathan M Davis <issues.dl...@jmdavisprog.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |issues.dl...@jmdavisprog.co
                   |                            |m

--- Comment #9 from Jonathan M Davis <issues.dl...@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.

--

Reply via email to