RFR: 8281195: Mistakenly used logging causes significant overhead in interpreter [v2]

David Holmes dholmes at openjdk.java.net
Tue Feb 8 02:30:08 UTC 2022


On Mon, 7 Feb 2022 20:22:36 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> The problem is that here we use multiple print()/cr() statements to make up a single log message, thus we cannot simply use regular log_trace(). The only obvious way to avoid multiple if statements is to quote whole body with one if and introduce else branch without logging. But as I understand the intention of LogStream is exactly to build log message as a combination of pieces, so I don't see any problem here
>
> The logging framework was intended to avoid these explicit if statements also.  It seems it could be refactored to duplicate the loops with logging, and not combine them with verification.

The logging framework was also supposed to not introduce overhead if logging is not enabled, but that is not the case as has been discovered here. I prefer the `if` statements to duplicating the code to have one block with logging and one without.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7367


More information about the hotspot-runtime-dev mailing list