X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=benchmarks%2Fversus-external-pools%2Fbench.sh;h=7221ba32e538c089e88636a855a7ea2681b1df76;hb=4e00547616376d120323f2fc8518ed73a7d45868;hp=34ebb788c0cd90341e9264cc1cb83b19f3c7568f;hpb=7a6a0a967f5d0978d7ad0714616194fe7592f69a;p=poolifier.git diff --git a/benchmarks/versus-external-pools/bench.sh b/benchmarks/versus-external-pools/bench.sh index 34ebb788..7221ba32 100755 --- a/benchmarks/versus-external-pools/bench.sh +++ b/benchmarks/versus-external-pools/bench.sh @@ -1,34 +1,51 @@ #!/usr/bin/env bash -### The -t argument permit to specify the type of task that you want to benchmark. -### The -s argument permit to specify the size of task that you want to benchmark. -### Supported values are CPU_INTENSIVE, IO_INTENSIVE +usage() { + echo "Usage: $0 [-s -i -t ] [-n ]" 1>&2 + exit 1 +} -taskType='CPU_INTENSIVE' -taskSize=5000 -while getopts "t:s:h" option +while getopts "s:i:t:n:h" option do case "${option}" in + s) + poolSize=${OPTARG} + ;; + i) + iterations=${OPTARG} + ;; t) taskType=${OPTARG} ;; - s) + 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) - echo "Usage: $0 [-t taskType] [-s taskSize]" - exit 1 + usage ;; esac done -echo 'Running benchmarks for task type:' ${taskType} 'and task size:' ${taskSize} +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 TASK_TYPE=${taskType} export TASK_SIZE=${taskSize} -# Execute bench -export NODE_ENV=production -export POOL_SIZE=10 -export NUM_ITERATIONS=100000 +export POOL_SIZE=${poolSize} +export NUM_ITERATIONS=${iterations} case "$OSTYPE" in darwin*) caffeinate ./hyperfine_benchmarks.sh