new D2.0 + C++ language
Christopher Wright
dhasenan at gmail.com
Fri Mar 20 22:19:31 PDT 2009
Rainer Deyke wrote:
> Christopher Wright wrote:
>> Games have strict performance requirements that a stop-the-world type of
>> garbage collector violates. Specifically, a full collection would cause
>> an undue delay of hundreds of milliseconds on occasion. If this happens
>> once every ten seconds, your game has performance problems. This is not
>> true of pretty much any other type of application.
>
> If you spend hundreds of milliseconds on garbage collection every ten
> second, you spend multiple percent of your total execution time on
> garbage collection. I wouldn't consider that acceptable anywhere.
I was pulling numbers out of my ass. If I wanted to do a proper job, I
would have built a large application and modified druntime to get proper
timings.
0.1 seconds out of every ten is a small amount to pay for the benefits
of garbage collection in most situations. (Most GUI applications are
idle most of the time anyway.) I did, however, specifically make the
point that it's unacceptable in some situations. These situations may be
your situations. Even so, the garbage collector might not be that slow.
(And for what it's doing, that seems pretty fast to me.)
It would be cool if the GC could watch for what pages have been written
to since the last collection and only bother looking through them. That
would require some additional accounting. On Windows, there's a system
call GetWriteWatch that works in that regard, but on Linux, the only
solution I've seen is marking the memory readonly and trapping SIGSEGV.
That would be pretty expensive.
More information about the Digitalmars-d
mailing list