Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I always figured the .pdb files were only used by the debugger. If the runtime always checks for them for debug info, that should mean slower execution when throwing an exception, because it has to read the .pdb, right?</p> <p>So I made a quick test:</p> <pre><code>using System; using System.Text; namespace PdbSpeedTest { class Program { static void Main(string[] args) { DateTime start = DateTime.Now; try { Program p = new Program(); p.Looper(0); } catch (NotImplementedException e) { Console.WriteLine(e.StackTrace); } TimeSpan span = DateTime.Now - start; Console.WriteLine(span.TotalMilliseconds.ToString()); } internal void Looper(int x) { try { if (x &lt; 100) Looper(x + 1); else throw new NotImplementedException("blah!"); } catch (NotImplementedException e) { throw new NotImplementedException("blah!", e); } } } } </code></pre> <p>This just recurses 100 levels deep and throws an exception. Now for the runtime results:</p> <p>Running as a <strong>debug</strong> build <strong>with</strong> the .pdb in the same folder:</p> <pre><code>C:\Work\PdbSpeedTest\bin\Debug&gt;PdbSpeedTest.exe at PdbSpeedTest.Program.Looper(Int32 x) in C:\Work\PdbSpeedTest\Program.cs:line 37 at PdbSpeedTest.Program.Main(String[] args) in C:\Work\PdbSpeedTest\Program.cs:line 16 31.2504 </code></pre> <p>Running as a <strong>debug</strong> build <strong>without</strong> the .pdb:</p> <pre><code>C:\Work\PdbSpeedTest\bin\Debug&gt;PdbSpeedTest.exe at PdbSpeedTest.Program.Looper(Int32 x) at PdbSpeedTest.Program.Main(String[] args) 15.6252 </code></pre> <p>Running as a <strong>release</strong> build <strong>with</strong> the .pdb:</p> <pre><code>C:\Work\PdbSpeedTest\bin\Release&gt;PdbSpeedTest.exe at PdbSpeedTest.Program.Looper(Int32 x) in C:\Work\PdbSpeedTest\Program.cs:line 37 at PdbSpeedTest.Program.Main(String[] args) in C:\Work\PdbSpeedTest\Program.cs:line 16 31.2504 </code></pre> <p>Running as a <strong>release</strong> build <strong>without</strong> the .pdb:</p> <pre><code>C:\Work\PdbSpeedTest\bin\Release&gt;PdbSpeedTest.exe at PdbSpeedTest.Program.Looper(Int32 x) at PdbSpeedTest.Program.Main(String[] args) 15.6252 </code></pre> <p>These were run from a regular old command prompt, not inside Visual Studio. So the .pdb definitely does add stack trace info, and slows down the exception handling. Very interesting!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload