4 ms·
Correct. Although the performance characteristics are different. An exception in Java generates a stack trace, which is relatively expensive. So not a great ide
by HendrikHensen 9mo ago
Correct. Although the performance characteristics are different. An exception in Java generates a stack trace, which is relatively expensive. So not a great idea in un-exceptional code paths that need to perform well.
- vips7L 9mo agoStack trace collection is optional. If you actually hit a performance problem on a checked exception path you just override the stack trace collection not to happen. I do this in most of my projects that use checked exceptions as domain errors. Only once you have to panic, i.e wrap in an unchecked exception, stack trace collection happens.