{
auto mt = measureTime!((TickDuration a)
{ /+ do something when the scope is exited +/ });
// do something that needs to be timed
}
is functionally equivalent to
{
auto sw = StopWatch(AutoStart.yes);
scope(exit)
{
TickDuration a = sw.peek();
/+ do something when the scope is exited +/
}
// do something that needs to be timed
}
making measureTime redundant. So, it should be deprecated.
And this is a deprecation that Walter Bright actually endorses. When discussing the differences between benchmark and measureTime, when he was trying to figure out how to time some code, he agreed with my assessment that measureTime was redundant and that it should be removed, because it basically just does what scope(exit) does already except that it's less flexible.
Comment #1 by razvan.nitu1305 — 2017-07-12T10:49:27Z
ping. Should we still deprecate it?
Comment #2 by issues.dlang — 2017-07-12T11:11:33Z
It's going to be. It's marked as shceduled for deprecation at the moment, and I'll be deprecating it soon.
Comment #3 by razvan.nitu1305 — 2017-07-12T11:13:08Z
Ok. Close this when you think is the best time (now or after the deprecation takes place)
Comment #4 by pro.mathias.lang — 2020-01-14T11:43:40Z