Re: try/catch performance
"Dan Peder Eriksen" <firstname.lastname@example.org> wrote in message news:<wwMemail@example.com>...
> "EnKan" <firstname.lastname@example.org> wrote in message
> news:email@example.com om...
> > I'm not sure that I may have interpreted correctly the
> > wording of the author who implied this, but is it true
> > that a piece of code that is encapsulated within a try block
> > executes very slowly compared to one that is NOT ?
> > I have been of the belief that it is when, and only when,
> > an exception actually occurs that the "handling" of the exception
> > is probably expensive.
> > Would someone please clarify !
> > TIA , (and sorry for the duplicate post if there happens to
> > be one)
> Code that's inside a try block doesn't execute slowly.
> What's slow is creating an Exception(throw new Exception("some exception")).
> This is because the exception has to get the stacktrace and this takes time.
Thanks very much for the clarification.
I'm trying to get all my facts about try/catch impact on performance,
if any. Is it a fact that a method containing a try/catch block
will NOT be inlined ? Also, if I'm invoking a method within a
try block which in turn would invoke other methods, but none
of which of those contain any try/catch blocks, then would there
be any inlining problems at all (w.r.t try/catch) ?
Thanks for your patience.
|All times are GMT. The time now is 12:21 AM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.