Skip to content

Commit e639e2a

Browse files
JamalMullaJamal Mulla
and
Jamal Mulla
authored
Second attempt with various improvements (#510)
* Initial chunked impl * Bytes instead of chars * Improved number parsing * Custom hashmap * Graal and some tuning * Fix segmenting * Fix casing * Unsafe * Inlining hash calc * Improved loop * Cleanup * Speeding up equals * Simplifying hash * Replace concurrenthashmap with lock * Small changes * Script reorg * Native * Lots of inlining and improvements * Add back length check * Fixes * Small changes --------- Co-authored-by: Jamal Mulla <[email protected]>
1 parent b91c95a commit e639e2a

File tree

3 files changed

+176
-188
lines changed

3 files changed

+176
-188
lines changed

calculate_average_JamalMulla.sh

+8-2
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,11 @@
1515
# limitations under the License.
1616
#
1717

18-
JAVA_OPTS="--enable-preview -XX:+UnlockExperimentalVMOptions -XX:+TrustFinalNonStaticFields -XX:+UseTransparentHugePages"
19-
java $JAVA_OPTS --class-path target/average-1.0.0-SNAPSHOT.jar dev.morling.onebrc.CalculateAverage_JamalMulla
18+
19+
20+
if [ -f target/CalculateAverage_JamalMulla_image ]; then
21+
target/CalculateAverage_JamalMulla_image
22+
else
23+
JAVA_OPTS="--enable-preview -XX:+UnlockExperimentalVMOptions -XX:+TrustFinalNonStaticFields -XX:+UseTransparentHugePages -XX:-TieredCompilation"
24+
java $JAVA_OPTS --class-path target/average-1.0.0-SNAPSHOT.jar dev.morling.onebrc.CalculateAverage_JamalMulla
25+
fi

prepare_JamalMulla.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,10 @@
1616
#
1717

1818
source "$HOME/.sdkman/bin/sdkman-init.sh"
19-
sdk use java 21.0.1-graal 1>&2
19+
sdk use java 21.0.2-graal 1>&2
20+
21+
# ./mvnw clean verify removes target/ and will re-trigger native image creation.
22+
if [ ! -f target/CalculateAverage_JamalMulla_image ]; then
23+
NATIVE_IMAGE_OPTS="--gc=epsilon -O3 -march=native --enable-preview --strict-image-heap --link-at-build-time -R:MaxHeapSize=64m -da -dsa --no-fallback --initialize-at-build-time=dev.morling.onebrc.CalculateAverage_JamalMulla"
24+
native-image $NATIVE_IMAGE_OPTS -cp target/average-1.0.0-SNAPSHOT.jar -o target/CalculateAverage_JamalMulla_image dev.morling.onebrc.CalculateAverage_JamalMulla
25+
fi

0 commit comments

Comments
 (0)