D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3532 - benchmark function consumes 100% CPU when used with anonymous delegate
Summary: benchmark function consumes 100% CPU when used with anonymous delegate
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86_64 Windows
: P2 critical
Assignee: Andrei Alexandrescu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-20 06:28 UTC by Vadym Stetsiak
Modified: 2015-06-09 01:27 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Vadym Stetsiak 2009-11-20 06:28:03 UTC
Following code, consumes 100% for an infinite period of time.

However, if I use benchmark with predefined function - everything is OK.

The code to reproduce:

import std.date;

void main()
{
        ulong[] measures = benchmark!(delegate void()
        {
                for(int i = 0; i < 100_000; i++)
                {
                        auto res1 = cmp1 == cmp2;
                }
                
        })(1, null);
}
Comment 1 Andrei Alexandrescu 2009-11-20 10:06:35 UTC
Thank you for going through the trouble of creating an account and reporting this.
Comment 2 Lars T. Kyllingstad 2010-06-21 11:41:16 UTC
This is not a Phobos issue, it's a bug in DMD.  I've reported it with a reduced test case, see issue 4359.