X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Fversus-external-pools%2Fbench.sh;h=7221ba32e538c089e88636a855a7ea2681b1df76;hb=8ea47589a8f04b7018bd39c230d68de456c27bb0;hp=f78500f773032e33411ffdf820d1e3e582cc902c;hpb=bd0e5c4dda309d307e83ddfd8a974df631fc21da;p=poolifier.git diff --git a/benchmarks/versus-external-pools/bench.sh b/benchmarks/versus-external-pools/bench.sh index f78500f7..7221ba32 100755 --- a/benchmarks/versus-external-pools/bench.sh +++ b/benchmarks/versus-external-pools/bench.sh @@ -1,24 +1,51 @@ #!/usr/bin/env bash -### The -t argument is needed to specify the type of task that you want to benchmark. -### Supported values are CPU_INTENSIVE +usage() { + echo "Usage: $0 [-s -i -t ] [-n ]" 1>&2 + exit 1 +} -taskType='CPU_INTENSIVE' -while getopts t: flag +while getopts "s:i:t:n:h" option do - case "${flag}" in + case "${option}" in + s) + poolSize=${OPTARG} + ;; + i) + iterations=${OPTARG} + ;; t) taskType=${OPTARG} ;; + n) + taskSize=${OPTARG} + ;; + :) + echo "Error: Missing option argument for '-${OPTARG}'" >&2; + usage + ;; + \?) + # Invalid option + echo "Error: Unknown or invalid option for '-${OPTARG}'" >&2; + usage + ;; + *|h) + usage + ;; esac done -echo 'Running bench for task type:' $taskType -export TASK_TYPE=$taskType -# Execute bench +taskType=${taskType:-'CPU_INTENSIVE'} +taskSize=${taskSize:-5000} +poolSize=${poolSize:-$(nproc --all)} +iterations=${iterations:-100000} + +echo 'Running benchmarks with pool size:' ${poolSize}', number of iterations:' ${iterations}', task type:' ${taskType} 'and task size:' ${taskSize} export NODE_ENV=production -export POOL_SIZE=10 -export NUM_ITERATIONS=100000 +export TASK_TYPE=${taskType} +export TASK_SIZE=${taskSize} +export POOL_SIZE=${poolSize} +export NUM_ITERATIONS=${iterations} case "$OSTYPE" in darwin*) caffeinate ./hyperfine_benchmarks.sh