Created
August 19, 2020 16:03
-
-
Save doom369/64a41df972b60a067f02a0ba1f11e739 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@BenchmarkMode(Mode.AverageTime) | |
@Fork(1) | |
@State(Scope.Thread) | |
@Warmup(iterations = 5, time = 1) | |
@OutputTimeUnit(TimeUnit.NANOSECONDS) | |
@Measurement(iterations = 10, time = 1) | |
public class EnumValues { | |
@Benchmark | |
public void enumValuesMethod(Blackhole bh) { | |
for (WidgetProperty property : WidgetProperty.values()) { | |
bh.consume(property); | |
} | |
} | |
@Benchmark | |
public void enumValuesVariable(Blackhole bh) { | |
for (WidgetProperty property : WidgetProperty.values) { | |
bh.consume(property); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment