From 18129762d423c07be9c781668a0f35d655ab755f Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sat, 12 Sep 2026 21:56:42 +0200 Subject: [PATCH] Omit the stacktrace for JOniException * The stacktrace is not very useful and is very expensive, for example for Regexp#to_s on a Regexp like /(?i:a)|(?i:b)/. * On ruby-bench's railsbench it accounts for about 8% of the request time. * Rails master has been improved to use #source instead, https://github.com/rails/rails/pull/58678, but that doesn't affect existing releases. --- src/org/joni/exception/JOniException.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/org/joni/exception/JOniException.java b/src/org/joni/exception/JOniException.java index c2c5d479..cd70df89 100644 --- a/src/org/joni/exception/JOniException.java +++ b/src/org/joni/exception/JOniException.java @@ -25,4 +25,12 @@ public class JOniException extends RuntimeException{ public JOniException(String message) { super(message); } + + // The stacktrace is not very useful and is very expensive, + // for example for Regexp#to_s on a Regexp like /(?i:a)|(?i:b)/ + @SuppressWarnings("sync-override") + @Override + public final Throwable fillInStackTrace() { + return this; + } }