STL performance in 2012RC is slower?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<span style="text-align:left <span style=" <span style="font-size:14px We are using Visual Studio 2005. We have a large C++ application which uses STL and Boost. <span style="font-size:14px; line-height:21px Performance<span style="font-size:14px is
critical for our application.
<span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; text-align:left We are looking at upgrading to Visual Studio 2012 once it is released. I tried this small program in Visual Studio 2012 RC and was surprised to see
it ran more than 2X slower in a release build than the same code build with Visual Studio 2005. In VS2012 I used default release build settings. For me it takes about 20ms in VS2005 and about 50ms in VS2012. Why is it that much slower?
<span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; text-align:left Note: we did find turning exceptions off in the 2012 compiler sped up the timings a lot. Exceptions were on in the 2005 build. <span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; text-align:left Turning
off exceptions would break a lot of our production code. It would be a huge amount of work to try and get rid of every single exception. How would we deal with third party libraries?
<span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; text-align:left Its this performance hit because of STL, just the deque template, exceptions or 2012 in general? Will this be different in the production version
of VS 2012<br/>

<span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; text-align:left
<span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; text-align:left //----------------------------------------------------------------------------------------------------------
<pre class="lang-c prettyprint" style="padding:5px; border:0px; font-size:14px; vertical-align:baseline; background-color:#eeeeee; font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif; width:auto; max-height:600px; text-align:left <code style="margin:0px; padding:0px; border:0px; font-size:14px; vertical-align:baseline; font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif <span class="com" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:gray #include<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <span class="str" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#800000 <windows.h><span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <br/><span class="com" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:gray #include<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <span class="str" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#800000 <deque><span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <br/><br/><span class="kwd" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#00008b using<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <span class="kwd" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#00008b namespace<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent std<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 ;<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <br/><br/>deque<span class="str" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#800000 <int><span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent d<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 ;<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <br/><br/><span class="kwd" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#00008b int<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent main<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 (<span class="kwd" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#00008b int<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent argc<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 ,<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <span class="kwd" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#00008b char<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 *<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent argv<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 [])<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <br/><span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 {<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <br/> <span class="kwd" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#00008b const<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <span class="kwd" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#00008b int<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent COUNT <span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 =<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <span class="lit" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#800000 5000000<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 ;<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <br/><br/> timeBeginPeriod<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 (<span class="lit" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#800000 1<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 );<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <br/><br/> <span class="kwd" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#00008b for<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 (<span class="kwd" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#00008b int<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent i <span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 =<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <span class="lit" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#800000 0<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 ;<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent i <span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 <<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent COUNT<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 ;<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 ++<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent i<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 )<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <br/> <span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 {<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <br/> d<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 .<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent push_back<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 (<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent i<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 );<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <br/> <span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 }<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <br/><br/> <span class="kwd" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#00008b double<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent sum <span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 =<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <span class="lit" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#800000 0<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 ;<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <br/><br/> DWORD start <span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 =<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent timeGetTime<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 ();<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <br/><br/> <span class="kwd" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#00008b for<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 (<span class="kwd" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#00008b int<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent i <span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 =<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <span class="lit" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#800000 0<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 ;<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent i <span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 <<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent COUNT<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 ;<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 ++<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent i<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 )<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <br/> <span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 {<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <br/> sum <span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 +=<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent d<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 [<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent i<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 ];<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <br/> <span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 }<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <br/><br/> printf<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 (<span class="str" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#800000 "time=%dmsn"<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 ,<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent timeGetTime<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 ()<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 -<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent start<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 );<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <br/><br/> printf<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 (<span class="str" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#800000 "sum=%fn"<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 ,<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent sum<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 );<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <br/><br/> <span class="kwd" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#00008b return<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <span class="lit" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#800000 0<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 ;[/code][/code]
<span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; text-align:left

View the full article
 
Back
Top