Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.
Date: 2008oct1 Language: C/C++ Keywords: STL, Standard Template Library, optimize, speed Q. How can I make my STL <list> faster? A. <list> is doubly-linked which isn't needed in many applications. Consider using <slist> which is singly-linked. Takes less time linking and it also uses less space. Try using a <vector> instead. You might be surprised. Its sometimes faster since it doesn't have do a malloc() for each element. Can you reserve() some space? This often helps.
Add a commentSign in to add a comment