Skip to content

Instantly share code, notes, and snippets.

@zivce
Created May 26, 2021 07:05
Show Gist options
  • Save zivce/daedb06e70f1f85cd8f3a25c6dce55c5 to your computer and use it in GitHub Desktop.
Save zivce/daedb06e70f1f85cd8f3a25c6dce55c5 to your computer and use it in GitHub Desktop.
@Warmup(iterations = 50, time = 2, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = 3, time = 2, timeUnit = TimeUnit.MILLISECONDS)
@Fork(1)
@State(Scope.Benchmark)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@BenchmarkMode({ Mode.AverageTime})
public class CatClient {
private static Cat9 cat9 = new Cat9("Cat9");
private static Cat cat = new Cat("OlderCat");
@Benchmark
public void testJava9Way()
{
cat9.walk();
cat9.retreat();
cat9.fastRetreat();
cat9.fastWalk();
cat9.run();
}
@Benchmark
public void testJava8Way()
{
cat.walk();
cat.retreat();
cat.fastRetreat();
cat.fastWalk();
cat9.run();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment