>Logger levels are mutable to allow switching them at runtime, JIT can not make an assumption that the log level will stay the same.
Java HotSpot can make and verify that assumption. And switch code when the level changes.
Java HotSpot can make and verify that assumption. And switch code when the level changes.
If (a) DoExpensiveStuff());
Becomes
When modifyA() RecompileIfWithNewAValue();
As long as you call the initial if more often than you modify (a), you’re fine (and the JVM was able to see that you called your if 10k times without modifying the value of (a) even once)