Why is D's GC slower than GO's?

rikki cattermole rikki at cattermole.co.nz
Mon Oct 31 02:16:03 UTC 2022


On 31/10/2022 12:38 PM, Templated Person wrote:
> On Sunday, 30 October 2022 at 22:36:15 UTC, Walter Bright wrote:
>> That's exactly like ownership/borrowing. D does it in @live functions.
> 
> I don't understand why is it not a goal to replace the GC with Swift / 
> Nim-like reference counting. Stuff like `@live` already is in the works 
> and can be used to optimize some reference count operations away.

Indeed a borrow checker could be used to elide calls to reference 
counting when you borrow the memory.

If only it wasn't opt-in on a function, and instead was guaranteed based 
upon the fact that it was borrowed...

Of course eliding can also occur if we have proper reference counting 
primitives for structs/classes. LLVM has directives for this to allow 
eliding regardless of what the frontend does.

It would also solve the const/immutable problem for reference counting 
types :)


More information about the Digitalmars-d mailing list