3 ms·
>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
by callmeal 5y ago
>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.
- nbevans 5y agoSo you've moved the IF statement that was checking the logging level from the program code into the JIT. Great. No saving. (And I doubt it actually does this - as it's not gaining anything)
- molyss 5y agoYou didn’t move the IF. you literally removed it. 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)
- ludamad 5y agoRespectfully, your post is very wrong :) JIT compilers are very fast and run once to prep the code that will run many times. If you had flat code that was always run exactly once the games would be lesser, yes