加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 执行.pdbs减缓发布应用程序?

发布时间:2020-12-15 04:09:53 所属栏目:百科 来源:网络整理
导读:如果.pdb(程序调试)文件包含在.dll中,则行号将出现在抛出的任何异常的堆栈跟踪中.这是否影响应用程序的性能? 这个问题不是关于版本与调试,即优化.关于具有.pdb文件的性能影响.每次抛出异常时,是否读取.pdb文件?加载程序集时,信息是否以某种方式缓存?还是
如果.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的文章也是一个很好的阅读.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读