Skip to content

Instantly share code, notes, and snippets.

@zivce
Created May 26, 2021
Embed
What would you like to do?
@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