Benchmarks and anonymous delegates
Vadym Stetsiak
vadmyst at gmail.com
Thu Nov 19 14:13:11 PST 2009
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?
More information about the Digitalmars-d
mailing list