From 6c0949969a5df71df85397ce3338f0154e6727ac Mon Sep 17 00:00:00 2001 From: Roman Musin <995612+roman-r-m@users.noreply.github.com> Date: Tue, 23 Jan 2024 19:19:07 +0000 Subject: Native image + a few smaller optimisations (#564) * Inline parsing name and station to avoid constantly updating the offset field (-100ms) * Remove Worker class, inline the logic into lambda * Accumulate results in an int matrix instead of using result row (-50ms) * Use native image --- prepare_roman-r-m.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'prepare_roman-r-m.sh') diff --git a/prepare_roman-r-m.sh b/prepare_roman-r-m.sh index f83a3ff..a0593b2 100755 --- a/prepare_roman-r-m.sh +++ b/prepare_roman-r-m.sh @@ -17,3 +17,12 @@ source "$HOME/.sdkman/bin/sdkman-init.sh" sdk use java 21.0.1-graal 1>&2 + +# ./mvnw clean verify removes target/ and will re-trigger native image creation. +if [ ! -f target/CalculateAverage_roman_r_m_image ]; then + + JAVA_OPTS="--enable-preview -dsa" + NATIVE_IMAGE_OPTS="--initialize-at-build-time=dev.morling.onebrc.CalculateAverage_roman_r_m --gc=epsilon -Ob -O3 -march=native --strict-image-heap $JAVA_OPTS" + + native-image $NATIVE_IMAGE_OPTS -cp target/average-1.0.0-SNAPSHOT.jar -o target/CalculateAverage_roman_r_m_image dev.morling.onebrc.CalculateAverage_roman_r_m +fi \ No newline at end of file -- cgit v1.2.3