• Post Reply Bookmark Topic Watch Topic
  • New Topic

try catch performance overhead...  RSS feed

 
Paul Michael
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have this one huge code block and only a few methods throw exceptions.
what is the performance overhead of placing this entire code in a try catch block as compared to just placing the methods which throw exceptions inside the try catch?
 
Jon Strayer
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
None.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Immaterial. What you should be asking yourself is where the try/catch structures make logical sense within your program.
hth,
bear
 
Mark Herschberg
Sheriff
Posts: 6037
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the record, I believe it does technically cost one instruction. But that's almost none. See Peter Haggar's book, Practical Java.
--Mark
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!