I need to sort object that arrive to a process X before treating them.
Object are sorted given to a time-stamp - a 64 bit number.
When object are timed out(a few milli) and sorted, the process X start to look at them.
Most of the time the object arrive sorted, between 3% and 5% the objects are out of order.
So i need a structure that allow me to:
- insert quickly elements
- remove quickly timed out elements
What should be the best to sort them, in term of performance?
I started to implement with boost::circular_buffer.
If boost::heap is better for this, which boost::heap should i use? Because there are a few(fibonacci, binomial, priority queue...)
I am using boost 1_49 but i can use a newer version also.
With circular buffer i insert most of the elements at the beginning of the buffer. But it can be O(n) in some case.
But to take timed out element it is O(1)