Re: perf & Try Catch

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Jeff Louie (anonymous_at_devdex.com)
Date: 01/01/05


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!



Relevant Pages

  • Re: perf & Try Catch
    ... A try catch finally decomposes into a nested try catch so I ... > would assume try catch finally should have a greater overhead than try ... but you can have a try-catch or a try-finally block - you don't ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: UPDATE or INSERT in same statement
    ... David C wrote: ... if a row was actually updated, this adds a measurable amount of overhead ... Updates are indexed operations because they require SQL Server look up a ...
    (microsoft.public.sqlserver.programming)
  • Re: A Program To Check The Activities Of Another Program
    ... david wrote: ... and it could be dangerous sitting under them as they fly ... overhead. ... -- RFC 1925 ...
    (microsoft.public.vc.language)