std.benchmark is in reviewable state
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon Sep 26 15:00:36 PDT 2011
On 9/26/11 9:04 AM, Jose Armando Garcia wrote:
> On Sun, Sep 25, 2011 at 6:08 PM, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>> Comments and suggestions are welcome.
>
> Very nice. Really like the functionality. Really like how you
> implemented "void benchmarkModule(string mod)(File target = stdout)".
> I have a few comments.
>
> My main concern on how this function works is that it looks at the
> module for methods starting with benchmark_. I like the idea in
> general but I am worry that it would pollute the symbol space. Does
> this work with private symbols? Can the user make all the members
> private and it will still work?
Not sure whether the compiler allows it, but it shouldn't work if one
module benchmarks another. That doesn't worry me - benchmark functions
are meant to be exposed for anyone to play with and it doesn't seem a
function starting with "benchmark_" is casually confusable.
> What about versioning should the user
> version all the benchmark members with version(Benchmark) or something
> like that?
As they wish. We will indeed define a version(StdBenchmark) for Phobos
itself.
> Should the user just create a benchmark module that would
> just contain all these benchmark functions. What do you recommend to
> the user? Should the doc contain these recommendations?
Good idea. I will add some typical physical designs.
> One last comment for now. Maybe we can make the prefix, 'benchmark_',
> configurable by passing it to benchmarkModule(...).
Good idea, will do.
> I think that benchmarkModule would greatly benefit from annotation it
> would be nice if the user could write:
>
> @benchmark("list")
> private void listInsert() {...}
I think the benefit would be only marginal.
Thanks,
Andrei
More information about the Digitalmars-d
mailing list