Skip to content

Instantly share code, notes, and snippets.

@doom369
Last active August 20, 2020 09:44
Show Gist options
  • Save doom369/804c9bca242e04afd40b78aa731a3331 to your computer and use it in GitHub Desktop.
Save doom369/804c9bca242e04afd40b78aa731a3331 to your computer and use it in GitHub Desktop.
@BenchmarkMode(Mode.AverageTime)
@Fork(1)
@State(Scope.Thread)
@Warmup(iterations = 5, time = 1)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Measurement(iterations = 10, time = 1)
public class EnumValueOf {
@Param({"LABEL", "ON_LABEL", "MAX"})
String strParams;
@Benchmark
public WidgetProperty enumValueOf() {
return WidgetProperty.valueOf(strParams);
}
@Benchmark
public WidgetProperty enumSwitch() {
return WidgetProperty.valueOfSwitch(strParams);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment