3 ms·
You didn’t move the IF. you literally removed it. If (a) DoExpensiveStuff()); Becomes When modifyA() RecompileIfWithNewAValue(); As long as you call the
by molyss 5y ago
You 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)