Hacker News new | ask | show | jobs
by haagen 2332 days ago
In Java, you can pre-allocate static final Exception objects with a pre-filled stack. These exceptions have much better performance characteristics [1] and are used by Netty [2] for control flow purposes. Sometimes these are helpful and the performance is good, but only when you don't need a full stacktrace or to customize the error message.

[1] http://normanmaurer.me/blog/2013/11/09/The-hidden-performanc...

[2] https://github.com/netty/netty