How expensive are Exceptions [duplicate]

Exceptions are not free… so they are expensive 🙂

The book Effective Java covers this in good detail.

  • Item 39 Use exceptions only for exceptional conditions.
  • Item 40 Use exceptions for recoverable conditions

The author found that exceptions resulted in the code tunning 70 times slower for his test case on his machine with his particular VM and OS combo.

Leave a Comment