Skip to content

Commit

Permalink
style(bench): shellcheck suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdoret committed Aug 26, 2024
1 parent f1284fd commit c80493c
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions tools/bench/benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ BASE_DIR=$(mktemp -d)
BASE_URL="$(git config --get remote.origin.url)"
(
git clone \
--branch ${BASE_BRANCH} \
${BASE_URL} \
${BASE_DIR} \
&& cd ${BASE_DIR} \
--branch "${BASE_BRANCH}" \
"${BASE_URL}" \
"${BASE_DIR}" \
&& cd "${BASE_DIR}" \
&& just build "${BUILD_ARGS[@]}"
)
BASE_BIN="${BASE_DIR}/target/${PROFILE}/tripsu"
Expand All @@ -41,15 +41,15 @@ if [ ! -f ${INPUT} ]; then
curl "${DATA_URL}" \
| xz -dc - \
| rdfpipe-rs -i rdf-xml -o nt - \
> ${INPUT} || rm ${INPUT}
> "${INPUT}" || rm "${INPUT}"
fi

# setup config
RULES=$(mktemp)
BASE_IDX=$(mktemp)
COMP_IDX=$(mktemp)

cat << EOF > ${RULES}
cat << EOF > "${RULES}"
nodes:
of_type:
Expand Down Expand Up @@ -97,19 +97,20 @@ HEAP_PSD_OUT=$(mktemp)
mem_prof() {
local name=$1
local cmd=$2
local HEAP_OUT=$(mktemp)
local HEAP_OUT
HEAP_OUT=$(mktemp)
echo -n "$name: "
heaptrack -o "${HEAP_OUT}" ${cmd} >/dev/null
heaptrack -o "${HEAP_OUT}" "${cmd}" >/dev/null
heaptrack_print "${HEAP_OUT}.zst" \
| grep '^peak heap memory'
}

# indexing
mem_prof "${BASE_BRANCH}" "${BASE_CMD_IDX}" > ${HEAP_IDX_OUT}
mem_prof "${COMP_BRANCH}" "${COMP_CMD_IDX}" >> ${HEAP_IDX_OUT}
mem_prof "${BASE_BRANCH}" "${BASE_CMD_IDX}" > "${HEAP_IDX_OUT}"
mem_prof "${COMP_BRANCH}" "${COMP_CMD_IDX}" >> "${HEAP_IDX_OUT}"
# pseudonymization
mem_prof "${BASE_BRANCH}" "${BASE_CMD_PSD}" > ${HEAP_PSD_OUT}
mem_prof "${COMP_BRANCH}" "${COMP_CMD_PSD}" >> ${HEAP_PSD_OUT}
mem_prof "${BASE_BRANCH}" "${BASE_CMD_PSD}" > "${HEAP_PSD_OUT}"
mem_prof "${COMP_BRANCH}" "${COMP_CMD_PSD}" >> "${HEAP_PSD_OUT}"

### Reporting

Expand All @@ -126,21 +127,21 @@ Run time compared using hyperfine
### Indexing
$(cat ${HYPF_IDX_OUT})
$(cat "${HYPF_IDX_OUT}")
### Pseudonymization
$(cat ${HYPF_PSD_OUT})
$(cat "${HYPF_PSD_OUT}")
## Memory
Heap memory usage compared using heaptrack
### Indexing
$(cat ${HEAP_IDX_OUT})
$(cat "${HEAP_IDX_OUT}")
### Pseudonymization
$(cat ${HEAP_PSD_OUT})
$(cat "${HEAP_PSD_OUT}")
MD

0 comments on commit c80493c

Please sign in to comment.