ARC, worth it or not?

前端 未结 7 1530
没有蜡笔的小新
没有蜡笔的小新 2021-02-05 09:53

When I moved to Objective C (iOS) from C++ (and little Java) I had hard time understanding memory management in iOS. But now all this seems natural and I know retain, autoreleas

相关标签:
7条回答
  • 2021-02-05 10:19

    I discovered: ARC makes your code A LOT faster. In Apples WWDC video they say, that a couple of CPU cycles are saved for each NSObject's retain and release methods. This is because there is no need to check it on runtime anymore (It is outsourced to the compiler now). It's about 6 CPU cycles for each retain. If you use a loop which creates a lot of objects, then you can really feel the difference.

    ARC not only makes the code faster, but YOU write less code, which accelerates your development process dramatically. And last but not least you must not search for memoryleaks by about 90% of your code. If you don't use a lot of low-level stuff, which must use "__bridge casts", you are COMPLETELY out of memory leaks.

    Conclusion: If you can do it, DO IT!

    0 讨论(0)
提交回复
热议问题