aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xadditional_build_steps_thomaswue.sh21
-rwxr-xr-xcalculate_average_thomaswue.sh9
-rwxr-xr-xevaluate2.sh21
-rwxr-xr-xprepare_thomaswue.sh6
4 files changed, 17 insertions, 40 deletions
diff --git a/additional_build_steps_thomaswue.sh b/additional_build_steps_thomaswue.sh
deleted file mode 100755
index ab2f365..0000000
--- a/additional_build_steps_thomaswue.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-#
-# Copyright 2023 The original authors
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-source "$HOME/.sdkman/bin/sdkman-init.sh"
-sdk use java 21.0.1-graal 1>&2
-NATIVE_IMAGE_OPTS="--gc=epsilon -O3 -march=native --enable-preview"
-native-image $NATIVE_IMAGE_OPTS -cp target/average-1.0.0-SNAPSHOT.jar -o image_calculateaverage_thomaswue dev.morling.onebrc.CalculateAverage_thomaswue
diff --git a/calculate_average_thomaswue.sh b/calculate_average_thomaswue.sh
index 87a4fc4..58c6701 100755
--- a/calculate_average_thomaswue.sh
+++ b/calculate_average_thomaswue.sh
@@ -15,13 +15,12 @@
# limitations under the License.
#
-
-if [ -f ./image_calculateaverage_thomaswue ]; then
- echo "Picking up existing native image, delete the file to select JVM mode." 1>&2
- ./image_calculateaverage_thomaswue
+if [ -f target/CalculateAverage_thomaswue_image ]; then
+ echo "Picking up existing native image 'target/CalculateAverage_thomaswue_image', delete the file to select JVM mode." 1>&2
+ target/CalculateAverage_thomaswue_image
else
JAVA_OPTS="--enable-preview"
- echo "Chosing to run the app in JVM mode as no native image was found, use additional_build_step_thomaswue.sh to generate." 1>&2
+ echo "Chosing to run the app in JVM mode as no native image was found, use prepare_thomaswue.sh to generate." 1>&2
java $JAVA_OPTS --class-path target/average-1.0.0-SNAPSHOT.jar dev.morling.onebrc.CalculateAverage_thomaswue
fi
diff --git a/evaluate2.sh b/evaluate2.sh
index ab91817..b7f5414 100755
--- a/evaluate2.sh
+++ b/evaluate2.sh
@@ -20,8 +20,7 @@ set -eo pipefail
if [ -z "$1" ]
then
echo "Usage: evaluate2.sh <fork name> (<fork name 2> ...)"
- echo " for each fork, there must be a 'prepare_<fork name>.sh' script and a 'calculate_average_<fork name>.sh' script"
- echo " there may be an 'additional_build_steps_<fork name>.sh' script too"
+ echo " for each fork, there must be a 'calculate_average_<fork name>.sh' script and an optional 'prepare_<fork name>.sh'."
exit 1
fi
@@ -132,12 +131,6 @@ for fork in "$@"; do
sdk use java $DEFAULT_JAVA_VERSION
fi
- # Optional additional build steps
- if [ -f "./additional_build_steps_$fork.sh" ]; then
- echo "+ ./additional_build_steps_$fork.sh"
- ./additional_build_steps_$fork.sh
- fi
-
# Use hyperfine to run the benchmarks for each fork
HYPERFINE_OPTS="--warmup 1 --runs 5 --export-json $fork-$filetimestamp-timing.json --output ./$fork-$filetimestamp.out"
@@ -236,14 +229,14 @@ for fork in "$@"; do
# Read java version from prepare_$fork.sh if it exists, otherwise assume 21.0.1-open
java_version="21.0.1-open"
- if [ -f "./prepare_$fork.sh" ]; then
- java_version=$(grep "sdk use java" ./prepare_$fork.sh | cut -d' ' -f4)
- fi
-
# Hard-coding the note message for now
notes=""
- if [ -f "./additional_build_steps_$fork.sh" ]; then
- notes="GraalVM native binary"
+ if [ -f "./prepare_$fork.sh" ]; then
+ java_version=$(grep -F "sdk use java" ./prepare_$fork.sh | cut -d' ' -f4)
+
+ if grep -F "native-image" -q ./prepare_$fork.sh ; then
+ notes="GraalVM native binary"
+ fi
fi
echo -n "$trimmed_mean;" >> $leaderboard_temp_file # for sorting
diff --git a/prepare_thomaswue.sh b/prepare_thomaswue.sh
index f83a3ff..10a1581 100755
--- a/prepare_thomaswue.sh
+++ b/prepare_thomaswue.sh
@@ -17,3 +17,9 @@
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_thomaswue_image ]; then
+ NATIVE_IMAGE_OPTS="--gc=epsilon -O3 -march=native --enable-preview"
+ native-image $NATIVE_IMAGE_OPTS -cp target/average-1.0.0-SNAPSHOT.jar -o target/CalculateAverage_thomaswue_image dev.morling.onebrc.CalculateAverage_thomaswue
+fi