Hi, can anyone help. I have some very intensive code (C++) which pushed huge numbers of small std::map classes around, iterates across them etc. making and deleting them on the way.
I have just ported the code to VS2008 from 2003 + Intel Compiler.
Another piece of code using the same base library has slowed down by factors of 100s but I have not looked in detail at it so there might be simpler explanations.
Not completely clear where the bottlenecks are so it would be good to have hints. Looks as if it migth be in the STL.
terry wrote: > Hi, can anyone help. I have some very intensive code (C++) which > pushed huge numbers of small std::map classes around, iterates > across them etc. making and deleting them on the way.
> I have just ported the code to VS2008 from 2003 + Intel Compiler.
> Unfortunately, the code runs very slowly! Roughly 2008 = 28 secs; > 2008 + Intel = 25secs ; 2003 = 14 secs ; VS2003 + Intel = 12 > seconds. > Another piece of code using the same base library has slowed down > by factors of 100s but I have not looked in detail at it so there > might be simpler explanations.
> Not completely clear where the bottlenecks are so it would be good > to have hints. Looks as if it migth be in the STL.
> Terry
Have you checked(!) the information on Checked Iterators, meaning some debugging is enabled by default even in release builds?
> terry wrote: >> Hi, can anyone help. I have some very intensive code (C++) which >> pushed huge numbers of small std::map classes around, iterates >> across them etc. making and deleting them on the way.
>> I have just ported the code to VS2008 from 2003 + Intel Compiler.
>> Unfortunately, the code runs very slowly! Roughly 2008 = 28 secs; >> 2008 + Intel = 25secs ; 2003 = 14 secs ; VS2003 + Intel = 12 >> seconds. >> Another piece of code using the same base library has slowed down >> by factors of 100s but I have not looked in detail at it so there >> might be simpler explanations.
>> Not completely clear where the bottlenecks are so it would be good >> to have hints. Looks as if it migth be in the STL.
>> Terry
> Have you checked(!) the information on Checked Iterators, meaning some > debugging is enabled by default even in release builds?
On Sun, 28 Jun 2009 21:53:15 +0100, "terry" <ne...@lyonstech.net> wrote:
>Hi, can anyone help. I have some very intensive code (C++) which pushed huge >numbers of small std::map classes around, iterates across them etc. making >and deleting them on the way.
Then consider using a vector with reserve (possibly sorted). The overhead of insertion/deletion with a map is considerable, more so than what vector provides
Bo Persson wrote: > terry wrote: >> Hi, can anyone help. I have some very intensive code (C++) which >> pushed huge numbers of small std::map classes around, iterates >> across them etc. making and deleting them on the way.
>> I have just ported the code to VS2008 from 2003 + Intel Compiler.
>> Unfortunately, the code runs very slowly! Roughly 2008 = 28 secs; >> 2008 + Intel = 25secs ; 2003 = 14 secs ; VS2003 + Intel = 12 >> seconds. >> Another piece of code using the same base library has slowed down >> by factors of 100s but I have not looked in detail at it so there >> might be simpler explanations.
>> Not completely clear where the bottlenecks are so it would be good >> to have hints. Looks as if it migth be in the STL.
>> Terry
> Have you checked(!) the information on Checked Iterators, meaning some > debugging is enabled by default even in release builds?
1. Make sure that your project is still being built with /O2 . There's some bug (whose details I forget, as I don't build with the IDE) where upgrading projects drops their optimization settings on the floor. "Oops."
2. Make sure that you're examining release performance, not debug performance (sounds obvious, but people make this mistake far too often).
3. Try defining _SECURE_SCL to 0 project-wide (the easiest way to do this is to compile all of your objects AND STATIC LIBRARIES with /D_SECURE_SCL=0 ). VS 2005 and VS 2008 added _SECURE_SCL, which is enabled by default. It provides a last line of defense against attackers trying to exploit buggy STL-using programs, at the cost of performance.
> Hi, can anyone help. I have some very intensive code (C++) which pushed > huge numbers of small std::map classes around, iterates across them etc. > making and deleting them on the way.
> I have just ported the code to VS2008 from 2003 + Intel Compiler.
> Another piece of code using the same base library has slowed down by > factors of 100s but I have not looked in detail at it so there might be > simpler explanations.
> Not completely clear where the bottlenecks are so it would be good to have > hints. Looks as if it migth be in the STL.