[Issue 20219] Idle D programs keep consuming CPU in Gcx.scanBackground

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 18 13:46:40 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=20219

--- Comment #5 from Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> ---
(In reply to Rainer Schuetze from comment #4)
> I don't have hard numbers, but IIRC the overhead was a couple of ms for
> tests that only ever run a single collection.

Then, would you agree that terminating the threads after a few seconds of
inactivity would be appropriate?

> Possible, but I'm not sure it is worth the effort. The threads use only a
> small stack of 16kB and are now just waiting for a common event.

I can look into implementing this if we agree otherwise.

> True, it's a compromise trading some thread handles and memory for better
> performance in most cases. I suspect most people (and especially the users
> of the program more than the developer) want the program to run faster, so
> the default should be that.

I think I would agree that GC speed is overall more important, though I don't
think we have the data for how D is used to make hard conclusions about which
tradeoff is better. It might be possible that GC speed would not be a large
factor of the performance of a typical D program? Most D users already must
undergo an additional step for their D programs to perform reasonably, which is
to switch to the GDC or LDC compiler.

> When I start any program in a debugger on Windows, I see 3 additional
> threads already running for that process when entering WinMain. I haven't
> seen any complaints about that.

The situation on other platforms might very well be different. I don't think
Windows has received nearly the same level of scrutiny about not wastefully
using resources as FOSS operating systems. Would you suggest making the default
behavior depend on the current OS?

--


More information about the Digitalmars-d-bugs mailing list