03-06-2012, 11:19 PM
I'd say the debyg crt is your main problem, especially if your app is multithreaded. I think you can actually use release crt with a debug build, but basically you'll be losing all kinds of debugging measures implemented in the debug crt, not only memory debugging, but also (off my memory) iterator-to-container checks, function calling conventions checks.
If you're sure you want to do this anyway, toggle your project's Runtime Library option on the "C/C++ -> Code Generation" page in the Project properties dialog. I suggest You first create a new configuration for this and leave your Debug cofiguration unchanged, in case you still need it or if something goes wrong.
Still, such a difference in performance usually means you're not using stuff the right way. Such as using the wrong kind of containers for your algorithms.
For a recent example, see MCS rev 368 - the conversion was initially using std::string and pushing data into it byte by byte. Reserving the memory beforehand didn't help much, but using a plain old fixed-size buffer did the job - simply because pushing a byte to the string meant a whole swarm of various tests done by the debug CRT and then serializing access to the string via a critical section - try do that 100k times
If you're sure you want to do this anyway, toggle your project's Runtime Library option on the "C/C++ -> Code Generation" page in the Project properties dialog. I suggest You first create a new configuration for this and leave your Debug cofiguration unchanged, in case you still need it or if something goes wrong.
Still, such a difference in performance usually means you're not using stuff the right way. Such as using the wrong kind of containers for your algorithms.
For a recent example, see MCS rev 368 - the conversion was initially using std::string and pushing data into it byte by byte. Reserving the memory beforehand didn't help much, but using a plain old fixed-size buffer did the job - simply because pushing a byte to the string meant a whole swarm of various tests done by the debug CRT and then serializing access to the string via a critical section - try do that 100k times