Skip to content

Commit

Permalink
Remove additional_build_steps_*.sh support (#301)
Browse files Browse the repository at this point in the history
There is no need to have it as preparation steps could be fit into prepare_*.sh
  • Loading branch information
AlexanderYastrebov authored Jan 11, 2024
1 parent 8602a35 commit c9183a5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 40 deletions.
21 changes: 0 additions & 21 deletions additional_build_steps_thomaswue.sh

This file was deleted.

9 changes: 4 additions & 5 deletions calculate_average_thomaswue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

21 changes: 7 additions & 14 deletions evaluate2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions prepare_thomaswue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c9183a5

Please sign in to comment.