Re: Real life cost of using exceptions for control flow?
From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 06/11/04
- Previous message: Bruno Jouhier [MVP]: "Re: Real life cost of using exceptions for control flow?"
- In reply to: Frank Hileman: "Re: Real life cost of using exceptions for control flow?"
- Next in thread: Pavel Lebedinsky: "Re: Real life cost of using exceptions for control flow?"
- Reply: Pavel Lebedinsky: "Re: Real life cost of using exceptions for control flow?"
- Reply: Frank Hileman: "Re: Real life cost of using exceptions for control flow?"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 11 Jun 2004 21:23:00 +0100
Frank Hileman <frankhil@no.spamming.prodigesoftware.com> wrote:
> This test cannot be generalized to all exception performance problems. We
> found exceptions thrown by System.Drawing during a display pass caused such
> a dramatic slow-down that we wrote elaborate code to avoid exceptions. It
> could be that exceptions thrown by unmanaged code wrappers are unusually
> slow. In general, the only way to determine the extent of the problem is to
> test on your own code.
>
> This is why the .NET design guidelines recommend avoiding exceptions for
> expected or common error conditions. Throwing exceptions during drawing
> operations, for example, should never be acceptable, since it causes so many
> problems. For us, the difference was a smooth display, versus an unusable
> display.
Well, I'm not sure that's really the reason - I suspect it's really
because using exceptions for normal control flow makes code harder to
follow. Performance is an issue, but I don't think it's the main one.
Certainly 200 exceptions an hour isn't going to affect most
applications at all.
-- Jon Skeet - <skeet@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
- Previous message: Bruno Jouhier [MVP]: "Re: Real life cost of using exceptions for control flow?"
- In reply to: Frank Hileman: "Re: Real life cost of using exceptions for control flow?"
- Next in thread: Pavel Lebedinsky: "Re: Real life cost of using exceptions for control flow?"
- Reply: Pavel Lebedinsky: "Re: Real life cost of using exceptions for control flow?"
- Reply: Frank Hileman: "Re: Real life cost of using exceptions for control flow?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|