Archived

This topic is now archived and is closed to further replies.

krakrazor

std::list

Recommended Posts

How is std::list for making alot(maybe in the millions) of items... they are probably gonna be cut into alot of big lists which lead to the smaller ones... but how will it perform? and what should i use if not std::list? It''s gonna be used for industrial strength productions.

Share this post


Link to post
Share on other sites
How it will perform (and what you would use instead) depend on how you''re going to use it. The statement you made is sufficiently vague that it''s impossible to judge what the best data structure(s) for the job would be.

Share this post


Link to post
Share on other sites
I''m not quite shure about std::list, but at least I''ve used std::set in my job to store a lot of data (something above 100,000) and it seems to work quite good and fast, so I guess std::list is a good option too.

Share this post


Link to post
Share on other sites
What SiCrane said.


“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”
— Brian W. Kernighan (C programming language co-inventor)

Share this post


Link to post
Share on other sites
well i dont know what type of operations you need to do on the data but access time for any linked list is O(n). maps and sets have a much faster access time normaly around O(log N), depending how it is implemented.

Do you have a key value for the objects? if so then i''d suggest using the std::map or std::set

Share this post


Link to post
Share on other sites
quote:
Original post by krakrazor
it''s gonna be a program which will load many many items and then it will do not so complicated operations on them like copieng, changing fields, and deleting fields.


Is it possible that you don''t need that many of them loaded *at a time*?

Share this post


Link to post
Share on other sites