C# · 12月 26, 2021

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



解决方法 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的文章也是一个很好的阅读.