From c80493c93905c961571dc8e0fce1af1857e796bf Mon Sep 17 00:00:00 2001 From: cmdoret Date: Mon, 26 Aug 2024 22:24:36 +0200 Subject: [PATCH] style(bench): shellcheck suggestions --- tools/bench/benchmark.sh | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/tools/bench/benchmark.sh b/tools/bench/benchmark.sh index ac3e57b..45cf4ad 100644 --- a/tools/bench/benchmark.sh +++ b/tools/bench/benchmark.sh @@ -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" @@ -41,7 +41,7 @@ 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 @@ -49,7 +49,7 @@ RULES=$(mktemp) BASE_IDX=$(mktemp) COMP_IDX=$(mktemp) -cat << EOF > ${RULES} +cat << EOF > "${RULES}" nodes: of_type: @@ -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 @@ -126,11 +127,11 @@ Run time compared using hyperfine ### Indexing -$(cat ${HYPF_IDX_OUT}) +$(cat "${HYPF_IDX_OUT}") ### Pseudonymization -$(cat ${HYPF_PSD_OUT}) +$(cat "${HYPF_PSD_OUT}") ## Memory @@ -138,9 +139,9 @@ 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