Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: try/catch performance

Thread Tools

Re: try/catch performance

Posts: n/a
"Dan Peder Eriksen" <(E-Mail Removed)> wrote in message news:<wwM%a.14549$(E-Mail Removed)>...
> "EnKan" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) 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.
> Dan

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.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Performance Tutorials Services - Boosting Performance by DisablingUnnecessary Services on Windows XP Home Edition Software Engineer Javascript 0 06-10-2011 02:18 AM
OCZ Rally High Performance USB2 (Dual Channel) Flash Memory Silverstrand Front Page News 0 09-20-2005 03:35 AM
How to quickly improve your computer's performance @ Bona... Silverstrand Front Page News 0 08-24-2005 01:26 PM Rockdirect XTI 3.8 Performance Silverstrand Front Page News 0 08-08-2005 02:37 PM
Web Form Performance Versus Single File Performance jm ASP .Net 1 12-12-2003 11:14 PM