C# Compiler Optimizations

前端 未结 3 807
没有蜡笔的小新
没有蜡笔的小新 2020-12-29 09:03

I\'m wondering if someone can explain to me what exactly the compiler might be doing for me to observe such extreme differences in performance for a simple method.



        
3条回答
  •  清酒与你
    2020-12-29 09:35

    To get a good understanding, you should look at the IL code generated.

    Compile the assembly, then make a copy of it and compile again with the optimizations. Then open both assemblies in .net reflector and compare the difference of the compiled IL.

    Update: Dotnet Reflector is available at http://www.red-gate.com/products/dotnet-development/reflector/

    Update 2: IlSpy seems like a good open source alternative. http://ilspy.net/

    Open Source Alternatives to Reflector?

提交回复
热议问题