From 953e92bd8f5c8e3a2600b860c62835434f23de46 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 12 Dec 2022 09:51:50 +0100 Subject: [PATCH] Add more CLI options to benchmarks vs. other pools: MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit - pool size - task run iterations Signed-off-by: Jérôme Benoit --- benchmarks/versus-external-pools/bench.sh | 28 +++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/benchmarks/versus-external-pools/bench.sh b/benchmarks/versus-external-pools/bench.sh index 377a1a5b..16ed0127 100755 --- a/benchmarks/versus-external-pools/bench.sh +++ b/benchmarks/versus-external-pools/bench.sh @@ -1,21 +1,23 @@ #!/usr/bin/env bash -### The -t argument permit to specify the type of task that you want to benchmark. -### Supported values are CPU_INTENSIVE, IO_INTENSIVE -### The -s argument permit to specify the size of task that you want to benchmark. - usage() { - echo "Usage: $0 [-t ] [-s ]" 1>&2 + echo "Usage: $0 [-s -i -t ] [-n ]" 1>&2 exit 1 } -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} ;; :) @@ -35,14 +37,16 @@ done taskType=${taskType:-'CPU_INTENSIVE'} taskSize=${taskSize:-5000} +poolSize=${poolSize:-10} +iterations=${iterations:-100000} -echo 'Running benchmarks for task type:' ${taskType} 'and task size:' ${taskSize} +echo 'Running benchmarks with pool size:' ${poolSize}', number of iterations:' ${iterations}', task type:' ${taskType} 'and task size:' ${taskSize} +exit 1 +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 -- 2.34.1