Andrei Alexandrescu , dans le message (digitalmars.D:145370), a écrit : > I've had a good time with std.benchmark today and made it ready for > submission to Phobos. As a perk I've added the %h format specifier, > which formats a number in human-readable form using SI prefixes. > > For those interested in discussing this prior to the formal review > process, the code is at: > > https://github.com/andralex/phobos/blob/benchmark/std/benchmark.d > https://github.com/andralex/phobos/blob/benchmark/std/format.d > > and the dox at > > http://erdani.com/d/web/phobos-prerelease/std_benchmark.html > http://erdani.com/d/web/phobos-prerelease/std_format.html > > Comments and suggestions are welcome. If possible, it would be great if > this submission were given a bump in the priority queue. This is because > with robust benchmarking in Phobos we can ask new, performance-sensitive > submissions, to add benchmarking. >
Nice piece of work. I quite don't like the use of a global (well, thread local) name for the benchmark clockWatch. What about giving the clockWatch instance as a parameter to the benchmarked functions if they need to pause/resume? That would also avoid the issue of naming benchmarkPause and benchmarkResume (btw, I would have named them pauseBenchmark and resumeBenchmark). -- Christophe
