We want to add an array of doubles to a circular buffer in Objective C many times a second.
We are currently using a NSMutableArray nested within another NSMutableArray (2D array). This works fine but is too slow for our needs.
We want to add to the circular buffer many times a second. When we do this and do performance monitoring we see the call to removeObjectAtIndex:0 become a bottleneck (shift n-1 objects or O(n-1)). This is because we have many thousands of entries in our circular buffer.
We have looked at possibly using STL and std::deque. We have also looked at CHDataStructures. As you know, STL is in in C++ and can be integrated but is not as straight forward as an Objective C solution. CHDataStructures is getting dated and is not ARC compliant.
Please suggest how we should implement a circular buffer (for our array of doubles) for high performance with a code sample if possible.