You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "vy (via GitHub)" <gi...@apache.org> on 2024/10/31 21:25:59 UTC
Re: [PR] Fix extended stack trace (i.e., `%xEx`) rendering performance regression (logging-log4j2)
vy commented on PR #3123:
URL: https://github.com/apache/logging-log4j2/pull/3123#issuecomment-2450842029
I am still observing a ~10x performance regression. I use the following crude script:
```java
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.impl.Log4jLogEvent;
import org.apache.logging.log4j.core.pattern.ExtendedThrowablePatternConverter;
import java.net.Socket;
public class Log4j2Issue3123 {
public static void main(String[] args) {
final Exception error = createException();
final LogEvent logEvent = Log4jLogEvent.newBuilder().setThrown(error).build();
final ExtendedThrowablePatternConverter converter = ExtendedThrowablePatternConverter.newInstance(null, null);
long startInstantNanos = System.nanoTime();
final StringBuilder buffer = new StringBuilder();
for (int i = 0; i < 5_000_000; i++) {
buffer.setLength(0);
converter.format(logEvent, buffer);
}
double durationSeconds = (System.nanoTime() - startInstantNanos) / 1e9;
System.out.format("took %.3f s%n", durationSeconds);
// 2.24.1 - 1.753 s
// 2.25.0 - 11.281 s
}
private static Exception createException() {
try {
new Socket("localhost", -1);
throw new IllegalStateException("should not have reached here");
} catch (final Exception error) {
return error;
}
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org