2 ms·
I don’t know anything about the benchmark, but how would you test GC implementations without reference types?
by kaba0 4y ago
I don’t know anything about the benchmark, but how would you test GC implementations without reference types?
- saagarjha 4y agoSwift’s value types have reference counts because they may have members that need their lifetimes to be managed appropriately. (For example, if they’re reference types.)
- danappelxx 4y agoThis is incorrect, value types are not referenced counted in Swift. If a value type contains a reference type member (usually an anti pattern!), then that member’s reference count is indeed incremented when the value type is copied. But it is not accurate to claim that value types themselves have reference counts.
- saagarjha 4y agoYes, fair enough. I was thinking of this more from the perspective of types that have internal reference types that are opaque so it’s effectively like the value type itself having a reference count on it, but yes, really it’s the internal storage that is getting the count.