Daily iOS
Performance and debugging

ARC traffic optimization

In Time Profiler, the top entries on the scrolling hot path are swift_retain, swift_release, and swift_bridgeObjectRetain. Why does this happen?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

Every time you pass reference types, existentials, or closures in a hot loop, the compiler inserts atomic retain/release calls. That's ARC traffic: the CPU is spending more on ownership bookkeeping than on the real work.

Share a question