ios - Object Array in Objective C with ARC -


i writing application i'd speed up. 1 way have thought switching using nsarray , nsmutablearray using straight c-style arrays of pointers.

i had tried naively do:

myobject** objects = (myobject**) malloc(n/2*sizeof(myobject*)) 

this reports compiler error when using arc doesn't know ** object; can fixed adding bridge directive.

my question how memory being handled , how memory management mixing c , objective-c objects.

two solutions are

myobject* __weak* objects = (myobject* __weak*) malloc(n/2*sizeof(myobject*));  myobject* __strong* objects = (myobject* __strong*) malloc(n/2*sizeof(myobject*)); 

what differences between 2 arrays , how go freeing/releasing them when done. nsarrays optimized point wouldn't result of speed up?

are nsarrays optimized point wouldn't result of speed up?

yes.

you should profile code in instruments -- chances if make heavy use of arrays, you're going find code spends of time in places other nsarray methods -objectatindex:.

taking step further, you should able tell us whether nsarray optimized sufficiently don't need improve it. if you're looking speed code replacing nsarray, should have profiled code , identified expensive parts. don't guess @ needs improved; measure it.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -