aboutsummaryrefslogtreecommitdiff
path: root/prepare_roman-r-m.sh
diff options
context:
space:
mode:
authorRoman Musin <995612+roman-r-m@users.noreply.github.com>2024-01-23 19:19:07 +0000
committerGitHub <noreply@github.com>2024-01-23 20:19:07 +0100
commit6c0949969a5df71df85397ce3338f0154e6727ac (patch)
tree852da4358648ab1992372230c16d2abc57bd3c82 /prepare_roman-r-m.sh
parentba793e88cd3c1b7767e00180c721b85cf5c50e28 (diff)
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
Diffstat (limited to 'prepare_roman-r-m.sh')
-rwxr-xr-xprepare_roman-r-m.sh9
1 files changed, 9 insertions, 0 deletions
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