I'm in the debugging / optimization phase with the iPhone app. I still have one bottleneck - the only place where the program has a noticeable lag, and this is in the following cycle: (By the way, I renamed the letters and types. (These names are much more readable for a person in a real application, but there is little sense in context, so I hope this is clear enough.) Here's the loop:
for(i=0;i<xLong; i+=yFloat*zShort){
aFloat=0.0;
for(int j=i;j<i+yFloat*zShort;j++){
aFloat=hArray[j]/kFloat;
}
bNSNumber = [NSNumber numberWithFloat:aFloat];
[cNSMutableArray addObject:bNSNumber];
}
All creation and purification of objections outside this cycle.
(It should be pretty straightforward what happens here, but basically I have a very large array (in millions) and I look at this array in pieces of length yFloat * zShort, adding all the elements in this chunk and inserting this final amount into another array . So if hArray is a million elements long and my block is 200, I will sum the first 200 elements, insert that value into cNSMutableArray and move on to the next 200 elements in hArray. At the end, cNSMutableArray will contain 5000 elements.)
When the outer loop is about 25k and the inner loop is about 200, this code takes about 4 seconds to run. I would really like it to be as large as possible, as in the real world, the outer loop may be a little longer.
Any ideas how to speed this up?
Thanks for any of your ideas!