[openbeos] Re: Performance question - BList vs STL list

  • From: Graham Gilmore <grahamg@xxxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Sun, 23 Oct 2005 01:18:33 -0400

Zenja Solaja wrote:

Hi. Just a quick question about possible performance issues for a project I'm working on. Given a choice between the SupportKits BList and the STL list (or vector), are there any reasons why I would want to select one over the other? The application is only intended for BeOS family.

I'm only interested in hearing performance related feedback (memory and speed).

Thanks.


It partly depends on your use case, although in general I would lean towards the STL containers as more performant. If you're simply looking for a container to hold things that you will later iterate through from first to last, a vector is your best choice as there is considerably less overhead (both speed and memory wise). If you plan to modify your data set a lot with additions and deletions which are not the first or last elements, you might consider using a list instead as it's a lot faster to insert or remove elements from the middle of a list, although it does use more memory.

        Graham

Other related posts: