Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Switch from Microsofts STL to STLport

I'm using quite much STL in performance critical C++ code under windows. One possible "cheap" way to get some extra performance would be to change to a faster STL library.

According to this post STLport is faster and uses less memory, however it's a few years old.

Has anyone made this change recently and what were your results?

like image 574
Laserallan Avatar asked Mar 02 '09 21:03

Laserallan


2 Answers

I haven't compared the performance of STLPort to MSCVC but I'd be surprised if there were a significant difference. (In release mode of course - debug builds are likely to be quite different.) Unfortunately the link you provided - and any other comparison I've seen - is too light on details to be useful.

Before even considering changing standard library providers I recommend you heavily profile your code to determine where the bottlenecks are. This is standard advice; always profile before attempting any performance improvements!

Even if profiling does reveal performance issues in standard library containers or algorithms I'd suggest you first analyse how you're using them. Algorithmic improvements and appropriate container selection, especially considering Big-O costs, are far more likely to bring greater returns in performance.

like image 170
MattyT Avatar answered Sep 21 '22 05:09

MattyT


Before making the switch, be sure to test the MS (in fact, Dinkumware) library with checked iterators turned off. For some weird reason, they are turned on by default even in release builds and that makes a big difference when it comes to performance.

like image 42
Nemanja Trifunovic Avatar answered Sep 21 '22 05:09

Nemanja Trifunovic