See https://bugs.openjdk.java.net/browse/JDK-8176593. This bug has supposedly been fixed. However, I just ran my benchmark and Java 11 is still twice as slow as Java 8. That said, walking the stack trace with StackWalker is 7 times faster than with Throwable. However, the various methods of walking the stack trace have widely varying degrees of overhead. I suggest running the benchmark above to view them if you plan on using StackWalker yourself. |