Hi,

I am new to Swift, and I have several questions about how ARC works in
Swift.

1. I read from one of the previous discussions in the swift-evolution list (
https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160208/009422.html)
that ARC operations are currently not atomic as Swift has no memory model
and concurrency model.  Does it mean that the compiler generates non-atomic
instructions for updating reference counts (e.g. using incrementNonAtomic()
instead of increment() in RefCount.h)?

2. If not, when does it use non-atomic ARC operations? Is there an
optimization pass to recognize local objects?

3. Without the concurrency model in the language, if not using GCD (e.g.
all Swift benchmark applications), I assume Swift applications are
single-threaded.  Then, I think we can safely use non-atomic ARC
operations.  Am I right?

4. Lastly, is there a way to measure the overhead of ARC (e.g. a compiler
flag to disable ARC)?

Thanks,
Jiho
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

Reply via email to