Re: perf & Try Catch
From: Jeff Louie (anonymous_at_devdex.com)
Date: 01/01/05
- Next message: vidalsasoon: "dllimport confusion"
- Previous message: Bradley1234: "Re: Is "Whidbey" going to de-skill developers ?"
- In reply to: David Levine: "Re: perf & Try Catch"
- Next in thread: David Levine: "Re: perf & Try Catch"
- Reply: David Levine: "Re: perf & Try Catch"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 01 Jan 2005 11:43:40 -0800
David... A try catch finally decomposes into a nested try catch so I
would
assume try catch finally should have a greater overhead than try catch.
Hand
coded try catch written in IL assembler looks like this.
.try // get user input
{
ldstr "Enter number: "
call void
[mscorlib]System.Console::Write(string)
call string [mscorlib]System.Console::ReadLine()
call int32 [mscorlib]System.Int32::Parse(string)
// parse may throw exception
stloc.1 // place valid user input into n_input
leave.s got_value // leave don't branch from
try
} // end .try
catch [mscorlib]System.Object
{
pop // remove exception from stack
ldstr "Invalid Number."
call void
[mscorlib]System.Console::WriteLine(string)
leave exit // invalid input so exit program
} // end handler
Regards,
Jeff
>Now, there are a lot of unanswered questions that the author does not
go
into, such as why the difference in performance between a try-catch
versus a
try-finally.<
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
- Next message: vidalsasoon: "dllimport confusion"
- Previous message: Bradley1234: "Re: Is "Whidbey" going to de-skill developers ?"
- In reply to: David Levine: "Re: perf & Try Catch"
- Next in thread: David Levine: "Re: perf & Try Catch"
- Reply: David Levine: "Re: perf & Try Catch"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|