Review of Andrei's std.benchmark

Dmitry Olshansky dmitry.olsh at gmail.com
Fri Sep 21 14:00:51 PDT 2012


On 21-Sep-12 23:59, Andrei Alexandrescu wrote:
> On 9/19/12 4:11 PM, "Øivind" wrote:
>> New question for you :)
>>
>> To register benchmarks, the 'scheduleForBenchmarking' mixin inserts a
>> shared static initializer into the module. If I have a module A and a
>> module B, that both depend on eachother, than this will probably not
>> work..? The runtime will detect the init cycle and fail with the
>> following error:
>>
>> "Cycle detected between modules with ctors/dtors"
>>
>> Or am I wrong now?
>
> I think you have discovered a major issue. Ideas on how to attack this?
>
Not ideal but...

Make scheduleForBenchmarking to mixin in something else but not code - 
say global templated struct with certain name.

Then it should be possible to do:

benchmarkModules!(module1, module2, ...);

That would search for this specific anchor at the top scope of modules 
and collect all info. I'm not sure we can pass module names as alias 
parameters but I think our meta-programming tricksters certainly did 
something along the these lines.

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list