Boost logo

Boost :

Subject: Re: [boost] Fastest Data-structure maybe from STL or Boost ..!!
From: Sergey Cheban (s.cheban_at_[hidden])
Date: 2013-10-09 06:29:17

On 09.10.2013 8:37, Rahul Mathur wrote:

> I wish to record 1000 real time data which need to be in sorted order.
> I used STL MAP which sorts using KEYS and than sorted the value using STL
> VECTOR, the complete scenario give me almost 6ms of time analysis. The
> TARGET is to achieve almost 1.5 - 2.0 ms.
It seems that you:
1. Posted to the wrong newsgroup. This newsgroup is about developing the
boost library itself.
2. Used the stl containers in a wrong way. Why do you need to sort your
data twice?

> Also, once this data structure is completely filled I want to delete the
> first data and replace it with the new data.
It is not easy to understand from your short description what exactly do
you need. Do you need to keep the sorted list of last 1000 data items
received? In this case, you could:
1. Insert new data to the end of the std::list.
2. Delete old data from the beginning of the std::list if necessary.
3. Use the boost::intrusive::multiset as a sorting interface to the data
in the list (note that intrusive containers do not own the data).

> Can I have the fastest data structure (STL or BOOST) techniques for the
> same.
There is no such thing as the fastest data structure. You should not
expect any magic from external libraries. You should find the algorithm
that processes your data in the fastest way and then try to find the
library that implements this algorithm.

Sergey Cheban

Boost list run by bdawes at, gregod at, cpdaniel at, john at