Improving first iteration by avoiding string creation as much as possible (#516)

- It avoids creating unnecessary Strings objects and handles with the station names with its djb2 hashes instead
- Initializes hashmaps with capacity and load factor
- Adds -XX:+AlwaysPreTouch
This commit is contained in:
adri
2024-01-20 21:27:34 +01:00
committed by GitHub
parent 36ffed1315
commit 0a7726cc64
3 changed files with 55 additions and 33 deletions

View File

@@ -16,6 +16,6 @@
#
JAVA_OPTS="-XX:+UseStringDeduplication -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC"
JAVA_OPTS="-XX:+UseStringDeduplication -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -XX:+AlwaysPreTouch"
java --enable-preview -classpath target/average-1.0.0-SNAPSHOT.jar dev.morling.onebrc.CalculateAverage_adriacabeza