Bug 3532 – benchmark function consumes 100% CPU when used with anonymous delegate

Status
RESOLVED
Resolution
INVALID
Severity
critical
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2009-11-20T06:28:00Z
Last change time
2015-06-09T01:27:03Z
Assigned to
andrei
Creator
vadmyst

Comments

Comment #0 by vadmyst — 2009-11-20T06:28:03Z
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 by andrei — 2009-11-20T10:06:35Z
Thank you for going through the trouble of creating an account and reporting this.
Comment #2 by bugzilla — 2010-06-21T11:41:16Z
This is not a Phobos issue, it's a bug in DMD. I've reported it with a reduced test case, see issue 4359.