Re: try/catch performance
"Dan Peder Eriksen" <email@example.com> wrote in message news:<wwMfirstname.lastname@example.org>...
> "EnKan" <email@example.com> wrote in message
> news:firstname.lastname@example.org 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 06:45 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.