digitalmars.D.bugs - [Issue 5794] New: std.datetime StopWatch (and perhaps benchmark) examples need a small fix
- d-bugmail puremagic.com (40/40) Mar 29 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5794
- d-bugmail puremagic.com (23/23) Mar 30 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5794
- d-bugmail puremagic.com (12/12) May 05 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5794
http://d.puremagic.com/issues/show_bug.cgi?id=5794 Summary: std.datetime StopWatch (and perhaps benchmark) examples need a small fix Product: D Version: unspecified Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: andrej.mitrovich gmail.com --- Comment #0 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2011-03-29 17:12:24 PDT --- The example code for StopWatch has this line: sw.peek().msec, "[ms]"); This doesn't compile. This should be: sw.peek().to!("msecs", int), "[ms]"); --- benchmark's description of the return value: "Returns: An array of n uints. Element at slot i contains the number of msecs spent in calling the ith function times times. " But the slot at i contains a TickDuration, not 'number of milliseconds'. You still have to use to!("timemagnitude", returntype") to convert it to milliseconds if you want to. E.g.: auto r = benchmark!(f0, f1, f2)(10_000_000); writeln( r[0].to!("msecs", int) ); Could you add that last line? It would really help in understanding the example. Either that or add nice foreach loop like so: auto r = benchmark!(f0, f1, f2)(10_000_000); foreach (duration; r) { writeln( duration.to!("msecs", int) ); } A mention that TickDuration is defined in core.time would also be useful (it took me a while to figure out where to find it). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 29 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5794 Jonathan M Davis <jmdavisProg gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |jmdavisProg gmx.com --- Comment #1 from Jonathan M Davis <jmdavisProg gmx.com> 2011-03-30 14:54:18 PDT --- I'll take a look at the StopWatch and benchmark comments and fix them if necessary. Most of that was written by SHOO (with a few tweaks by me - particularly when I renamed Ticks to TickDuration), and his English isn't always the best (it isn't his native language after all), so there could be some errors in there due to that or me or him just missing an error in the documentation. So, if you're aware of any obvious documentation mistakes in std.datetime, just add them here, and I'll take care of them. I'm currently overhauling std.datetime's unit tests though, so any fixes like that are likely to get done as part of that and so won't be done all that quickly (otherwise there's likely to be merge conflicts, which I don't want to deal with). Documentation fixes shouldn't be that critical though (important perhaps, but not critical). They'll definitely be fixed before the next release though. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 30 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5794 Jonathan M Davis <jmdavisProg gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED --- Comment #2 from Jonathan M Davis <jmdavisProg gmx.com> 2011-05-05 01:26:05 PDT --- Fixed: https://github.com/D-Programming-Language/phobos/commit/8e4b25d66ed59acebadda3e216535dded93b11a6 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 05 2011