Created
August 2, 2020 12:05
-
-
Save doom369/5b5dfaf226711c61c2dc3dcbb4eb790e to your computer and use it in GitHub Desktop.
This file contains hidden or 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) | |
@OutputTimeUnit(TimeUnit.NANOSECONDS) | |
@Fork(1) | |
@State(Scope.Thread) | |
@Warmup(iterations = 5, time = 1) | |
@Measurement(iterations = 10, time = 1) | |
public class Hashcode { | |
UserObjects userObjects; | |
UserIDEDefault userIDEDefault; | |
UserApacheCommons3 userApacheCommons3; | |
UserGuava userGuava; | |
UserLombok userLombok; | |
@Setup | |
public void setup() { | |
userObjects = new UserObjects("Dmytro", 35); | |
userIDEDefault = new UserIDEDefault("Dmytro", 35); | |
userApacheCommons3 = new UserApacheCommons3("Dmytro", 35); | |
userGuava = new UserGuava("Dmytro", 35); | |
userLombok = new UserLombok("Dmytro", 35); | |
} | |
@Benchmark | |
public int objectsHashcode() { | |
return userObjects.hashCode(); | |
} | |
@Benchmark | |
public int defaultHashCode() { | |
return userIDEDefault.hashCode(); | |
} | |
@Benchmark | |
public int apacheCommons() { | |
return userApacheCommons3.hashCode(); | |
} | |
@Benchmark | |
public int guava() { | |
return userGuava.hashCode(); | |
} | |
@Benchmark | |
public int lombok() { | |
return userLombok.hashCode(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment