Bug 12955 – Deprecated std.datetime.measureTime. It's redundant functionality.

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-06-20T09:11:26Z
Last change time
2020-01-14T11:43:40Z
Assigned to
No Owner
Creator
Jonathan M Davis

Comments

Comment #0 by issues.dlang — 2014-06-20T09:11:26Z
{ 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