[Mono-list] Exceptions and error codes.

Philippe Lavoie philippe.lavoie@cactus.ca
Tue, 25 Mar 2003 11:28:37 -0500


I was referring to try only which in your example would in 99.99% be the
only cost.=20

It doesn't mean I'm not confused :)

Phil

-----Original Message-----
From: Thong (Tum) Nguyen [mailto:tum@veridicus.com]=20
Sent: Tuesday, March 25, 2003 11:10 AM
To: 'Miguel de Icaza'; Philippe Lavoie
Cc: mono-list@lists.ximian.com
Subject: RE: [Mono-list] Exceptions and error codes.

> -----Original Message-----
> From: Miguel de Icaza [mailto:miguel@ximian.com]
> Sent: Wednesday, 26 March 2003 4:09 a.m.
> To: Philippe Lavoie
> Cc: tum@veridicus.com; mono-list@lists.ximian.com
> Subject: RE: [Mono-list] Exceptions and error codes.
>=20
> Hello,
>=20
> > I think the original point made was that unless you have profiling
> > information to back up any claim that "this part of the software"
will
> > slow you down. Then use a mechanism which will make your code more
> > maintainable.
> >
> > The example below clearly has performance issues. However if the
> > function handle_number_argument below takes 100 ms to process, the 5
or
> > 10 extra lines of assembly added by the try/catch becomes
meaningless in
> > terms of overall performance. You'd better spend your time improving
> > that function then rewriting the parser of Int32.
>=20
> You are confused.
>=20
> Throwing and catching an exception is not 10 extra lines of assembly,
it
> is very very expensive, on the order of thousands of instructions.
>=20

I think Phil was referring to the try/catch.  Throwing exceptions is
expensive -- but only if they're actually thrown.

^Tum