www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12955] New: Deprecated std.datetime.measureTime. It's

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

          Issue ID: 12955
           Summary: Deprecated std.datetime.measureTime. It's redundant
                    functionality.
           Product: D
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: jmdavisProg gmx.com

{
    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.

--
Jun 20 2014