However, I cannot simply find the corresponding UI in the C# project of Visual Studio. All I can find is to turn off optimization: the “optimize code” checkbox is what I have.
Can C# users control the optimization of the detailed compiler, such as C/C++? Do I have to provide compiler options on the command line?
alt text http://i32.tinypic.com/28ststh.png
You can adjust the runtime Some of the performance-related elements, such as GC strategy, but not many.
When I build benchmarks etc. from the command line, I tend to use something like this:
< /p>
csc /o+ /debug- Test.cs
(I believe I have seen the existence of matching pdb files have an impact on performance, maybe in terms of the cost of throwing exceptions, So the debug switch… but I may be wrong.)
Edit: If you want to see every difference in optimization, there is a way to prove interesting:
>Use and Compile the same code without optimization>Use ildasm or Reflector in IL mode to see the difference>Manually (using ilasm) apply the same changes one by one and measure the number of each change
< p>In Visual Studio C/C++ projects, you can easily modify the optimization settings of the compiler in the “Property Page|C/C++|Optimization”. For example, we can provide different optimization levels, such as /O2 and /O3, And advanced optimizations, such as “Ignore Frame Pointer”.
However, I cannot simply find the corresponding UI in the Visual Studio C# project. All I can find is to turn off optimization: “Optimization The code” checkbox is what I have.
Can C# users control the optimization of the detailed compiler, such as C/C++? Do I have to provide compiler options on the command line?
alt text http://i32.tinypic.com/28ststh.png
Most of the optimization of C# code is in JIT Compiler level instead of C# compiler. Basically there are no detailed settings available in C or C.
You can adjust some performance-related elements at runtime, such as GC strategy, But not a lot.
When I build benchmarks etc. from the command line, I tend to use something like this:
csc /o+ /debug- Test.cs
(I believe I have seen the existence of matching pdb files have an impact on performance, maybe in terms of the cost of throwing exceptions, so the debugging switch… but I may be wrong. )
Edit: If you want to see every difference in optimization, there is a way to prove interesting:
>Compile the same code with and without optimization> In IL mode Use ildasm or Reflector to see the difference>Manually (using ilasm) apply the same changes one by one and measure the number of each change