In my app I have to store path points into an array and then follow those points. To get a smoother run I usually have to dump a path into 5k points. This means I have to store 10k floats- 5k for x and 5k for y coordinates. Right now this is what I'm doing:
1.In the view load I initialize an NSArray with those 10k numbers like this:
pathPoints=[NSArray arrayWithObjects:[NSNumber numberWithFloat:-134.8427], [NSNumber numberWithFloat:148.8433], ....... and so on];
And then I read it like this:
int currentXIndex=..////
[[pathPoints objectAtIndex:currentXIndex] floatValue];
[[pathPoints objectAtIndex:currentXIndex+1] floatValue];
As you can see, each time when I need the next position? I have to unbox it(cast it from NSNumber to float). And I'm sure this takes a great deal of performance. Any suggestions how I can do this another, more performant way?