@
aguesuka 的确没有神秘加成, 可能就是程序员的个人习惯了
JMHPerfCondition.conditionInvokeFirst avgt 3 13.930 ± 3.733 ns/op
JMHPerfCondition.conditionInvokeLater avgt 3 13.742 ± 1.632 ns/op
```java
@
Benchmark public int conditionInvokeFirst() {
int a = SpecialCaseTest.getNumber();
if (a > 0) {
return 1;
} else {
return 0;
}
}
@
Benchmark public int conditionInvokeLater() {
int a;
if ((a = SpecialCaseTest.getNumber()) > 0) {
return 1;
} else {
return 0;
}
}
```