Hacker News new | ask | show | jobs
by flohofwoe 1018 days ago
ObjC's and Swift's ARC (Automatic Reference Counting) is not just dumb "reference-count everything", the compiler does static lifetime analysis and removes redundant refcounting operations.

In theory at least this may actually yield better results than in C++ and Rust where refcounting is implemented as stdlib feature and optimizations rely on "zero cost abstractions" late in the compilation process.

But even ARC needs a lot of handholding and manual tweaking if performance matters.

1 comments

Granted, it probably has improved a lot since 2016, but I didn't have an occasion to update my knowledge about Swift since then. Back then you definitely ended up with tons of pointless ARCs, but in fairness the compiler was brand new at that point so no wonder it wasn't good at optimizing stuff away.