-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Open
Labels
area-Diagnostics-coreclrenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionstenet-performancePerformance related issuePerformance related issue
Milestone
Description
Repro:
using System;
using System.Diagnostics;
while (true)
{
var sw = Stopwatch.StartNew();
for (int i = 0; i < 100; i++)
{
try { throw new Exception(); } catch { }
}
Console.WriteLine(sw.Elapsed);
}When I run that with ctrl-F5, I get output like:
00:00:00.0004349
00:00:00.0004371
00:00:00.0004347
00:00:00.0004366
00:00:00.0004440
When I run that with F5, I get output like:
00:00:01.9491196
00:00:01.8550998
00:00:01.8392192
00:00:01.8323522
00:00:01.8168992
That's a 4500x slowdown, with every exception throw/catch consuming ~20ms. And this does scale with exception count: if I increase the repro to 1000 exceptions, without the debugger it takes ~0.004s and with the debugger it takes ~18s.
While ideally well-behaved apps wouldn't throw lots of exceptions, this has shown to be a significant cause of slowdown for real apps while being developed, with a noticeable impact on developer inner loop performance especially if the exceptions occur at app startup.
sandyarmstrong, aromaa, Saibamen, fedeAlterio and omariom
Metadata
Metadata
Assignees
Labels
area-Diagnostics-coreclrenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionstenet-performancePerformance related issuePerformance related issue