24 January 2007

More on STLPort and Microsoft STL performance

Just a short post to add some clarity to my previous post on the subject of using STLPort with Visual Studio 2005 instead of the Microsoft STL implementation.

The code used in my observations is a C++ MFC based application. The STL used are mainly containers with virtually zero iostreams code (or at least so little it will not change the results). The container usage are from very large long-lived containers through to many short lived small containers and everything inbetween. Massive amounts of containers are created throughout the program lifetime. Luckily most containers are created in thread local storage and gets freed when the thread has done its work. The thread allocators use the allocator provided in STLPort.

The difference in performance is marked for what is essentially lots of insertions into STL containers and lots of reads from them. When we are talking about a 20% performance gain by using STLPort it is quite scary, but also means switching to Microsoft STL would be unacceptable to users because the slowdown would be so noticeable.