Benchmarks and anonymous delegates
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Thu Nov 19 16:00:28 PST 2009
Vadym Stetsiak wrote:
> Hi, all
>
> I'm encountering strange behavior when using anonymous delegates with bechmark function. In my case benchmark hangs and consumes 100% CPU.
>
> I'm using D2.
>
> Here's the code:
> import std.date;
>
> void main()
> {
> ulong[] measures = benchmark!(delegate void()
> {
> for(int i = 0; i < 100_000; i++)
> {
> auto res1 = cmp1 == cmp2;
> }
>
> })(1, null);
> }
>
> OTOH, when instead of anonymous delegate i use predefined function, benchmarks works just fine.
>
> What I'm missing?
This needs to be looked at. My guess is a bug in the compiler, but the
library may be at fault as well. Any chance you could please submit a
bug report?
http://d.puremagic.com/issues/enter_bug.cgi
Andrei
More information about the Digitalmars-d
mailing list