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

Paulo Pinto pjmlp at progtools.org
Mon Oct 31 08:18:00 UTC 2022


On Sunday, 30 October 2022 at 22:21:12 UTC, Walter Bright wrote:
> On 10/30/2022 12:26 PM, Paulo Pinto wrote:
>
>> You can read the documentation over here,
>> 
>> https://clang.llvm.org/docs/AutomaticReferenceCounting.html
>> 
>> https://developer.apple.com/library/archive/releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html#//apple_ref/doc/uid/TP40011226
>> 
>> https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html
>
> I didn't realize you classified ARC as a separate pointer type. 
> You can't do pointy things with it like pointer arithmetic, or 
> taking the address of a variable with it. It's sort of like an 
> associative array in D is a special type, but not what I'd 
> consider a pointer type. Even class references in D are not 
> really a special pointer type.
> ..

It is the same difference as GC pointers and untraced pointers in 
most languages with GC and low level systems programming 
capabilities.

You tag the pointer types with __autoreleasing, __strong, 
__unsafe_unretained, __weak.

And if you want to feel lucky instead of having safe code, you 
can also do pointer arithmetic with them, thankfully Swift only 
allows this in the unsafe variants.

See "Conversion of pointers to ownership-qualified types".



More information about the Digitalmars-d mailing list