“Throwing exceptions can negatively impact performance” – Believe it.
I was parsing a ton of strings (don’t ask) and catching FormatException (a lot). By a ton, I mean several hundred thousand parsed into dates and doubles. By a lot of exceptions, I mean 90% of the data was blank. Let’s just call it sparse. The process was taking about 30 seconds. I changed the code to avoid the FormatException:
o = double.Parse(value);
Performance improved by at least 10 times to under 3 seconds. Problem solved.
Turns out this is a bona fide pattern. The tester-doer pattern.