Skip to content

Commit

Permalink
Minor improvements in JMH scripts (#322)
Browse files Browse the repository at this point in the history
* Minor improvements in JMH scripts

* MStack renamed to OperandStack

* PR comments addressed

---------

Co-authored-by: mstepan <[email protected]>
  • Loading branch information
mstepan and mstepan authored May 10, 2024
1 parent 4c700c4 commit 30b59fc
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion jmh/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This module is used to run JMH performance tests on Chicory and make it easy to

There a few additional tools that are needed to see the benchmark results:

- `wget`
- [wget](https://www.gnu.org/software/wget/)
- `http-server` install with: `npm install http-server -g`

## Locally
Expand Down
3 changes: 2 additions & 1 deletion scripts/build-jmh-main.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#! /bin/bash
#!/usr/bin/env bash
set -euxo pipefail

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

(
cd "${SCRIPT_DIR}/.."
rm -rf main
git clone --depth 1 --branch main https://github.com/dylibso/chicory.git main
mvn -Pbenchmarks spotless:apply clean package -DskipTests
)
2 changes: 1 addition & 1 deletion scripts/build-jmh.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/bash
#!/usr/bin/env bash
set -euxo pipefail

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
Expand Down
2 changes: 1 addition & 1 deletion scripts/compile-resources.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/bash
#!/usr/bin/env bash
set -euxo pipefail

CONTAINER_IMAGE="docker.io/andreatp/chicory-compilation-support"
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-jmh-main.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/bash
#!/usr/bin/env bash
set -euxo pipefail

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-jmh.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/bash
#!/usr/bin/env bash
set -euxo pipefail

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
Expand Down
24 changes: 12 additions & 12 deletions scripts/show-results.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#! /bin/bash
#!/usr/bin/env bash
set -euxo pipefail

# Two options: run locally or download from GH Actions
TYPE=${1}

if [ "$TYPE" = "local" ]; then
echo "Disply local results"
echo "Display local results"
elif [ "$TYPE" = "ci" ]; then
echo "Disply CI results"
echo "Display CI results"
MAIN=${2}
CURRENT=${3}
else
Expand All @@ -19,29 +19,29 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

TEMP_DIR=${SCRIPT_DIR}/jmh-tmp

rm -rf ${TEMP_DIR}
mkdir -p ${TEMP_DIR}
rm -rf "${TEMP_DIR}"
mkdir -p "${TEMP_DIR}"

if [ "$TYPE" = "local" ]
then
echo "Arguments not provided using local results - not supported in the container image."
cp ${SCRIPT_DIR}/../main/jmh-result.json ${TEMP_DIR}/main.json
cp ${SCRIPT_DIR}/../jmh-result.json ${TEMP_DIR}/current.json
cp "${SCRIPT_DIR}"/../main/jmh-result.json "${TEMP_DIR}"/main.json
cp "${SCRIPT_DIR}"/../jmh-result.json "${TEMP_DIR}"/current.json
else
echo "Arguments provided downloading the artifacts."
wget -q ${MAIN} -O ${TEMP_DIR}/main.zip
wget -q ${CURRENT} -O ${TEMP_DIR}/current.zip
wget -q "${MAIN}" -O "${TEMP_DIR}"/main.zip
wget -q "${CURRENT}" -O "${TEMP_DIR}"/current.zip

unzip -q -p ${TEMP_DIR}/main.zip jmh-result.json > ${TEMP_DIR}/main.json
unzip -q -p ${TEMP_DIR}/current.zip jmh-result.json > ${TEMP_DIR}/current.json
unzip -q -p "${TEMP_DIR}"/main.zip jmh-result.json > "${TEMP_DIR}"/main.json
unzip -q -p "${TEMP_DIR}"/current.zip jmh-result.json > "${TEMP_DIR}"/current.json
fi

# Serve local assets
echo "To view results go to the following link:"
echo -e "\nhttp://jmh.morethan.io/?sources=http://localhost:3000/main.json,http://localhost:3000/current.json\n"
echo "Hit CTRL-C to stop the server"
(
cd ${TEMP_DIR}
cd "${TEMP_DIR}"
# Install http-server with:
# npm install http-server -g
http-server -s -p 3000 --cors
Expand Down
2 changes: 1 addition & 1 deletion scripts/update-readme-version.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/bash
#!/usr/bin/env bash
set -euxo pipefail

VERSION=${1}
Expand Down

0 comments on commit 30b59fc

Please sign in to comment.