EDIT: Major edit to remove my early-morning brain damage.
To provide some additional info for my point, to try to show steps that can be used to reduce the startup time for this number of exceptions. This code allows me to profile N calls with or without the exception being thrown:
void Run(int n, bool doThrow, bool doExcept)
{
for (int i = 0; i < n; i++)
{
if (doExcept)
{
try
{
if (doThrow)
throw new NotImplementedException();
}
catch (NotImplementedException)
{
}
}
}
}
The testing scenario gives the following numbers when no checkmarks are set in the Exceptions dialog, in Debug mode with the VS hosting process.
1; 4.000 msec
1: 0.000 msec (no throw)
1: 0.000 msec (no throw, no except)
10; 32.000 msec
10: 0.000 msec (no throw)
10: 0.000 msec (no throw, no except)
100; 780.000 msec
100: 0.000 msec (no throw)
100: 0.000 msec (no throw, no except)
1000; 7251.000 msec
1000: 0.000 msec (no throw)
1000: 0.000 msec (no throw, no except)
10000; 35694.000 msec
10000: 0.000 msec (no throw)
10000: 0.000 msec (no throw, no except)
So clearly the number of exceptions is what matters here, as you expected. I'll edit with some more numbers from different scenarios in a minute.
In debug with the VS hosting process, the exceptions take about 3.5-7 msec. Disabling the VS hosting process (which still allows debugging) in debug mode drops the time down to 1.9 msec per exception:
1; 3.000 msec
10; 21.000 msec
100; 198.000 msec
1000; 1917.000 msec
10000; 19065.000 msec
And release mode without the VS hosting process takes about 1.8 msec (edit after plugging in my laptop):
1; 3.000 msec
10; 17.000 msec
100; 184.000 msec
1000; 1823.000 msec
10000; 18248.000 msec
And running in release mode outside of the debugger is about 0.016 msec per exception:
1; 1.000 msec
10; 1.000 msec
100; 3.000 msec
1000; 19.000 msec
10000; 138.000 msec
So in my test setup, it still doesn't load "instantly" from the debugger with 10k exceptions in release. Though, this could be related to the problems I experienced before with my 2010 installation (I've since reinstalled). It does load extremely quickly outside of the debugger.
Here is my full testing rig:
static void Main(string[] args)
{
Stopwatch sw = new Stopwatch();
var p = new Program();
int[] tests = new int[] { 1, 10, 100, 1000, 10000 };
foreach (int n in tests) {
sw.Start();
p.Run( n, true, true);
sw.Stop();
Console.WriteLine(string.Format("{0}; {1:0.000} msec", n, sw.ElapsedMilliseconds));
sw.Start();
p.Run(n, false, true);
sw.Stop();
Console.WriteLine(string.Format("{0}: {1:0.000} msec (no throw)", n, sw.ElapsedMilliseconds));
sw.Start();
p.Run(n, false, false);
sw.Stop();
Console.WriteLine(string.Format("{0}: {1:0.000} msec (no throw, no except)", n, sw.ElapsedMilliseconds));
}
Console.WriteLine("Any key to exit...");
Console.ReadKey();
}