-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fasten DecodedInstruction #38
Milestone
Comments
vbmacher
pushed a commit
that referenced
this issue
Mar 10, 2017
This need to be measured. HashMaps are supposed to be faster than TreeMaps... https://www.baeldung.com/java-treemap-vs-hashmap |
I have measured the two implementations, using the following test: @Test
public void testPerformance() {
DecodedInstruction instruction = new DecodedInstruction();
HDecodedInstruction hinstruction = new HDecodedInstruction();
long start = System.nanoTime();
for (int i = 0; i < 2000000; i++) {
instruction.add(i, "SSSS" + i, i);
}
long end = System.nanoTime() - start;
System.out.println("TreeMaps: " + TimeUnit.NANOSECONDS.toMillis(end));
long hstart = System.nanoTime();
for (int i = 0; i < 2000000; i++) {
hinstruction.add(i, "SSSS" + i, i);
}
long hend = System.nanoTime() - hstart;
System.out.println("HashMaps: " + TimeUnit.NANOSECONDS.toMillis(hend));
} Where
So I will revert back the HashMaps |
I don't know how it can be fastened, so I will close the issue for now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instead of HashMaps use TreeMaps
The text was updated successfully, but these errors were encountered: