/optimize C# 编译器密钥的用途是什么?

What is /optimize C# compiler key intended for?(/optimize C# 编译器密钥的用途是什么?)
本文介绍了/optimize C# 编译器密钥的用途是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

/是否有完整的优化列表优化 C# 编译器密钥 随处可用?

为什么默认禁用?是否值得在实际应用中使用? -- 默认情况下,它仅在 Debug 配置中禁用,在 Release 中启用.

Why is it disabled by default? Is it worth using in a real-world app? -- it is disabled by default only in Debug configuration and Enabled in Release.

推荐答案

Scott Hanselman 有一篇博文 展示了/optimize(在 Release Builds 中启用)功能的几个示例.

Scott Hanselman has a blog post that shows a few examples of what /optimize (which is enabled in Release Builds) does.

作为一个总结:/optimize 做了很多没有给出确切数字或定义的事情,但其中一个更明显的是方法内联(如果你有一个方法 A(),它调用 B(),它调用 C(),它调用D(),编译器可能会跳过" B 和 C,直接从 A 转到 D),这可能会导致 Release 构建中出现奇怪"的调用堆栈.

As a summary: /optimize does many things with no exact number or definition given, but one of the more visible are method inlining (If you have a Method A() which calls B() which calls C() which calls D(), the compiler may "skip" B and C and go from A to D directly), which may cause a "weird" callstack in the Release build.

这篇关于/optimize C# 编译器密钥的用途是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)