gc vs explicit
Dave
Dave_member at pathlink.com
Fri Dec 8 12:04:34 PST 2006
Sean Kelly wrote:
> Dave wrote:
>> Sean Kelly wrote:
>>> Try explicitly calling _gc.fullCollect() between iterations of the
>>> inner loop, and disabling the GC explicitly there. Manipulation of
>>> the GC for performance-critical areas is an important and intentional
>>> feature.
>>>
>>
>> With that in mind... What if some of the GC API were built-in to the
>> language? This could be one of those areas that would set D apart as a
>> lower-level, performance orientated language. If a GC implementation
>> didn't support something, it would be stubbed for portability.
>> Likewise anything not covered explicitly by a built-in could be
>> covered by an import.
>>
>> Specifically:
>>
>> gcFullCollect()
>> gcGenCollect()
>> gcDisable()
>> gcEnable()
>>
>> or some such.
>
> Phobos already has std.gc for exactly this purpose. Or are you
> suggesting some of these features should be added as keywords, or
> perhaps automatically available, similar to the declaration of Object
> and Exception?
>
Yes, that way those optimization 'hints' would be codified into the language itself (like register
in C or inline in C++).
The goal would be to lower the barrier as much as possible ('encourage the use of') and give D
something codified that most other languages don't have.
You know, taking this one step further for convenience and safety could give us:
Replace:
>> gcDisable()
>> gcEnable()
with a built-in for:
std.gc.disable;
scope(exit) std.gc.enable;
usage:
void foo()
{
scopeGcDisable;
for(...){ ... }
}
>
> Sean
More information about the Digitalmars-d
mailing list