exceptions performance (Re: [Mono-devel-list] JIT profiling/benchmarking)

Michal Moskal malekith at pld-linux.org
Sat Jan 3 16:40:49 EST 2004

On Tue, Dec 30, 2003 at 12:22:40AM -0500, Ben Maurer wrote:
> As well, the frequent throwing of exceptions is not a measure of a
> correctly written application. Exceptions are designed to be thrown when
> an application has an *error*. 99.99% of the time, the user should see
> the exception, and it should result in either an aborting of the program
> or a reentry of data.

It is quite common for (at least some) functional languages to use
exceptions for ordinary control flow. Now when writing compiler for such
a language, do I need to invent my own exception handling techniques?
(for example some exceptions will never go out one function and it can be
determined statically, so it can be replaced with goto).

How fast (slow?) are exceptions?

I also heard about delegates being 20x slower when invoking and creating
then creating objects and invoking methods (*). But that was about .NET 1.0 (or
maybe 1.1? anyway in longhorn they claim to fix that). Is it also true
for mono?

I'm asking this since delegates are far more natural representation for
first class functions.

(*) I'm talking about something like:

interface Func2 {
  object apply (object a1, object a2);
interface Func3 {
  object apply (object a1, object a2, object a3);

: Michal Moskal :: http://www.kernel.pl/~malekith : GCS {C,UL}++++$ a? !tv
: When in doubt, use brute force. -- Ken Thompson : {E-,w}-- {b++,e}>+++ h

More information about the Mono-devel-list mailing list