gpt4 book ai didi

c# - .pdbs 会降低发布应用程序的速度吗?

转载 作者:可可西里 更新时间:2023-11-01 08:20:16 24 4
gpt4 key购买 nike

如果 .pdb(程序调试)文件包含在 .dll 中,则行号会出现在抛出的任何异常的堆栈跟踪中。这会影响应用程序的性能吗?


这个问题不是关于发布与调试,即优化。它是关于拥有 .pdb 文件的性能影响。每次抛出异常时是否读取 .pdb 文件?加载程序集时是否以某种方式缓存了信息?或者它是否在第一次抛出相关异常时被缓存?有多大区别?

最佳答案

John Robbins 在他的文章 Do PDB Files Affect Performance? 中写到了这一点.简单的答案是否定的(如果您使用/optimize+ 和/debug 开关编译您的发布版本):

That might be true on other operating systems, but not Windows. If you think they do, then why does Microsoft build every single product they ship with PDB files turned on for both debug and release builds? They wrote the compiler, they wrote the linker, and they wrote the operating system so they know exactly what the effects are. Microsoft has more people focused on performance than any other software company in the world. If there were any performance impact at all, they wouldn't do it. Period. Performance isn't the only thing at Microsoft, it's everything.

另外:

When built /optimize+ and a /debug switch, a DebuggingMode.IgnoreSequencePoints is passed to the DebuggableAttribute to tell the JIT compiler that it doesn't need to load the PDB file in order to correctly JIT the IL.

他还有另一篇文章题为PDB Files: What Every Developer Must Know这也是一本好书。

关于c# - .pdbs 会降低发布应用程序的速度吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1270986/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com