Possible Duplicate:
Is literal creation of an NSMutableDictionary less efficient than the class helper method?
According to the WWDC video that introduces ObjectiveC literals, NSMutableArray
s can be initialized like so:
[NSMutableArray arrayWithArray:@[]];
but what if we were to do it like this:
[@[] mutableCopy];
I know that one is initializing the array, and the other is just providing a shallow copy; thus the memory management is different. But if we are using ARC, what are the disadvantages of using the latter? Is it more expensive? ARC probably handles both differently, but I'm just wondering if using mutableCopy
is 'worse' or not.
[NSMutableArray array]
? – Orthogonal