c++ - Enable compiler optimisation only for individual functions/files -


i working on c++ code in visual studio 2012 environment. code base not huge (contained in around 10-12 source files). execution time of functions in project huge (say 10 sec in rel mode, 50 sec in debug mode)

now while debugging, require @ functions executing towards end of application lifetime. there way disable compiler optimisation specific functions and/or files in project. enable me have optimised execution of computationally extensive functions

note: had erroneously mentioned "debug symbols" instead of "compiler optimisation" previously. asking questions w.r.t. compiler optimisation because of can become difficult inspect variable values while debugging break points.

you can turn optimization on or off specific files in properties->c/c++->optimization dialog. same dialog use whole project, per file settings override project settings.

you can surround particular functions or areas of code #pragma optimize( "", off ) , #pragma optimize( "", on ) if prefer way.

either way you'll want generate debug symbols whole program. having them there doesn't slow down , allows debug optimized code if want to. it's more difficult since local variables , such not correct in watch window , line numbers may not line up, between , disassembly view can tell what's going on.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -