The try isn't too expensive, but the catch can be. However, running a
bunch of trys within a loop can also degrade performance.

The catch generates significant overhead when an exception is thrown
because a copy of the stack has to be created.

a quick search of google turns up:

http://www.javaworld.com/javaworld/javaqa/2001-07/04-qa-0727-try.html

http://ccm.redhat.com/doc/core-platform/5.0/engineering-standards/perfor
mance-optimization.html#Exceptions

there is also a good discussion of it in:

Java Performance Tuning published by O'Reilly.

In general, you should not use try / catch for flow control.

hope that helps...

mike chambers

[EMAIL PROTECTED]


> -----Original Message-----
> From: Kola Oyedeji [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, October 15, 2002 4:33 AM
> To: CF-Talk
> Subject: RE: switch-case was RE: BlueDragon (was RE: How is 
> CFMX J2EE implemented?)
> 
> 
> Hi
> 
> Sean, have I missed something, are you saying try and catch add a
> significant performance overhead?
> 
> 
> Thanks
> 
> Kola
> 
> >> -----Original Message-----
> >> From: Sean A Corfield [mailto:[EMAIL PROTECTED]]
> >> Sent: 15 October 2002 02:08
> >> To: CF-Talk
> >> Subject: Re: switch-case was RE: BlueDragon (was RE: How 
> is CFMX J2EE
> >> implemented?)
> >> 
> >>
> >> try/catch is a pretty heavy operation - you should only use it for
> >> (unexpected) error cases, not normal operation...
> >> 
> 
> 
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

Reply via email to