[Issue 13724] std.datetime.timeIt
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Nov 13 06:21:25 PST 2014
https://issues.dlang.org/show_bug.cgi?id=13724
--- Comment #3 from Steven Schveighoffer <schveiguy at yahoo.com> ---
You're looking at it from the perspective that the time is the main thing you
care about, i.e. you don't care about the return value, just the time it took.
I look at it from the perspective that you want to time something that you are
already using.
For example, if you have something like:
37.fibonacci.foo();
Now, you want to keep your code the same, but get the time it took to do
fibonacci, how do you do that with the tuple return?
With a ref parameter, you can do:
ulong timer;
37.fibonacci.timeIt(timer).foo();
Now I have the timer, and I don't have to mess with my call chain (much).
It also allows easier cumulative timing.
--
More information about the Digitalmars-d-bugs
mailing list