2 ms·
Refcounting in a single-threaded context is extremely quick and efficient. What's expensive is atomic reference counting, as seen e.g. in C++ shared_ptr<> and S
by zozbot234 6y ago
Refcounting in a single-threaded context is extremely quick and efficient. What's expensive is atomic reference counting, as seen e.g. in C++ shared_ptr<> and Swift ARC.
- vlovich123 6y agoInterestingly the Twitter thread is saying uncontended atomic operations are generally as fast as non-atomic, so I don’t think the weaker memory model is the totality of the reason. Another thing is apparently their branch predictor is specially tuned to work with how Objective-c dispatch works (which iirc Swift inherits in places too, and not just when interfacing with Obj-C APIs)