D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 12955 - Deprecated std.datetime.measureTime. It's redundant functionality.
Summary: Deprecated std.datetime.measureTime. It's redundant functionality.
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-20 09:11 UTC by Jonathan M Davis
Modified: 2020-01-14 11:43 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Jonathan M Davis 2014-06-20 09:11:26 UTC
{
    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 RazvanN 2017-07-12 10:49:27 UTC
ping. Should we still deprecate it?
Comment 2 Jonathan M Davis 2017-07-12 11:11:33 UTC
It's going to be. It's marked as shceduled for deprecation at the moment, and I'll be deprecating it soon.
Comment 3 RazvanN 2017-07-12 11:13:08 UTC
Ok. Close this when you think is the best time (now or after the deprecation takes place)
Comment 4 Mathias LANG 2020-01-14 11:43:40 UTC
Done in https://github.com/dlang/phobos/pull/5756 (2.077 / 2017-10)