1brc
1brc copied to clipboard
Minor improvement to @spullara
I forked @spullara's file and made a minor improvement that reduces execution time by 2-3%.
This reduced executive time from ~9.5
to ~9.3s
in hyperfine with 5 runs
- Class Name:
CalculateAverage_hundredwatt
- Machine specs: 8 cores, 32GB RAM
- JVM: 21.0.1-graalce
Improvement:
- Hard-code processing of the first character of the city name (which can never be
;
according to the input value ranges in the README), commit: 0ffa9bcc6944df4db2e0177e09640861631bc813
I ran hyperfine twice with benchmark order reversed the second time and saw the same results.
Hyperfine command:
hyperfine --warmup 1 --runs 5 ' java $JAVA_OPTS --class-path target/average-1.0.0-SNAPSHOT.jar dev.morling.onebrc.CalculateAverage_yemreinci' ' java $JAVA_OPTS --class-path target/average-1.0.0-SNAPSHOT.jar dev.morling.onebrc.CalculateAverage_hundredwatt'
(Note: hostname of this machine is fedora-s-8vcpu-16gb-amd-sfo3-01
, but I resized it to have 32gb of RAM)
Rebased my fork with latest main and ensured test.sh
passes
The original results excited me because the difference was small, but this change always had the min time. Not true after rebasing.
Seems like it may be a wash for the purposes of this challenge, curious what others think:
I am on the fence tbh. As per the rules, there should be significant improvements when basing on existing impls. Hard to draw a line of course, but to me this one feels below the threshold, in particular as it seems not consistently faster? I'm inclined to close this one.