"Single NSMutableArray" vs. "Multiple C-arrays" --Which is more Efficient/Practical?

Posted by RexOnRoids on Stack Overflow See other posts from Stack Overflow or by RexOnRoids
Published on 2010-05-16T05:28:40Z Indexed on 2010/05/16 5:30 UTC
Read the original article Hit count: 187

Filed under:
|
|
|
|

Situation:
I have a DAY structure. The DAY structure has three variables or attributes: a Date (NSString*), a Temperature (float), and a Rainfall (float).

Problem:
I will be iterating through an array of about 5000 DAY structures and graphing a portion of these onto the screen using OpenGL.

Question:
As far as drawing performance, which is better? I could simply create an NSMutableArray of DAY structures (NSObjects) and iterate on the array on each draw call -- which I think would be hard on the CPU. Or, I could instead manually manage three different C-Arrays -- One for the Date String (2-Dimensional), One for the temperature (1-Dimensional) and One for the Rainfall (1-Dimensional). I could keep track of the current Day by referencing the current index of the iterated C-Arrays.

© Stack Overflow or respective owner

Related posts about c

    Related posts about objective-c