12 Oct 2010 caolan   » (Master)

STL Performance comparison, gcc 4.5.1 vs STLPort 4.5

Taking Alan Ning STL performance comparison of VC9, VC10 and STLPort I converted it over for Linux (available here) and compared the built in STL of gcc 4.5.1 on x86_64 versus STLPort 4.5 both at -O2. Tests and test-descriptions below are lifted directly from Alan. Times are actually in milliseconds, not seconds, but I didn’t bother regenerating the graph legends.

Lower bars are better, hardware is an i7 with 6 gigs memory.

The test for vector involves three operations – insertion, iterator traversal, and copy.

Native STL consistently faster.


Native STL consistently faster.

The test for string involves three operations – string copy, substring search, and concatenation.

Native STL apparently worse with strings with approx more than 3200 characters.


Native STL typically slower.

The test for map involves insertion, search, and deletion.

Native STL typically worse with maps over 200 elements.


Native STL typically faster.

The test for Deque comes with a twist. The deque is implemented is as a priority queue through make_heap(), push_heap() and pop_heap(). Random items are inserted and removed from the queue upon each iteration.

Native STL faster.


Native STL faster.

In general the gcc STL looks comparatively good with the exception of large maps.

Syndicated 2010-10-12 10:14:09 from Caolan McNamara

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!