News for hackers. Stuff that matters.
Re:Apple is rewriting Foundation in Swift by dralley on Monday May 22, 2023 @01:27AM (#36027756)
Apple has always been preferential to reference counting (see Objective C) and it seems like they may have spent a fair bit of effort optimizing Apple Silicon for it.
Re:Apple is rewriting Foundation in Swift by GeekyBear on Monday May 22, 2023 @01:50AM (#36027878)
> it seems like they may have spent a fair bit of effort optimizing Apple Silicon for it

According to information released when the M1 came out: retaining and releasing an NSObject takes ~30 nanoseconds on current gen Intel, and ~6.5 nanoseconds on an M1

Re:Apple is rewriting Foundation in Swift by fulafel on Friday May 26, 2023 @04:03PM (#36088894)
It's good to reduce the cache hot best case time of course but isnt the more fundamental sin of RC in the extra read/write memory traffic, cache footprint and cross core cache line ping pong when incrementing object refcount fields.

(or if going with BRC, correspondingly there shouldn't be a advantages for this custom CPU feature)

Re:Apple is rewriting Foundation in Swift by pjmlp on Monday May 22, 2023 @06:14AM (#36029445)
Reference counting on Objective-C was plan B, after the failure of implementing a safe tracing GC in a language with C's semantics.

So they went with plan B, having the compiler automate the retain/release messages used by the Cocoa framework.

Everywhere else in Objective-C, the memory is still manually managed, or via memory pools.