X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Fversus-external-pools%2Fbench.sh;h=34ebb788c0cd90341e9264cc1cb83b19f3c7568f;hb=8c97ee641800a73d02516dad3e6b5172ec477e2d;hp=94c5a3b5e3f7a68053fce69fd4376f48e7bb62cd;hpb=79e7d3680bb510d4c5419701de6638fb19816c2c;p=poolifier.git diff --git a/benchmarks/versus-external-pools/bench.sh b/benchmarks/versus-external-pools/bench.sh index 94c5a3b5..34ebb788 100755 --- a/benchmarks/versus-external-pools/bench.sh +++ b/benchmarks/versus-external-pools/bench.sh @@ -1,31 +1,42 @@ -### The -t argument is needed to specify the type of task that you want to benchmark. -### Supported values are CPU_INTENSIVE +#!/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 taskType='CPU_INTENSIVE' -while getopts t: flag +taskSize=5000 +while getopts "t:s:h" option do - case "${flag}" in - t) taskType=${OPTARG};; - esac + case "${option}" in + t) + taskType=${OPTARG} + ;; + s) + taskSize=${OPTARG} + ;; + *|h) + echo "Usage: $0 [-t taskType] [-s taskSize]" + exit 1 + ;; + esac done -echo 'Running bench for task type:' $taskType -export TASK_TYPE=$taskType +echo 'Running benchmarks for task type:' ${taskType} 'and task size:' ${taskSize} +export TASK_TYPE=${taskType} +export TASK_SIZE=${taskSize} # Execute bench export NODE_ENV=production export POOL_SIZE=10 export NUM_ITERATIONS=100000 -hyperfine --export-markdown BENCH-100000.md --min-runs 10 \ - --prepare 'sleep 15' \ - 'node dynamic-piscina.js' \ - 'node fixed-piscina.js' \ - 'node dynamic-poolifier.js' \ - 'node fixed-poolifier.js' \ - 'node dynamic-suchmokuo-node-worker-threads-pool.js' \ - 'node static-suchmokuo-node-worker-threads-pool.js' \ - 'node threadjs.js' \ - 'node dynamic-workerpool.js' \ - 'node fixed-workerpool.js' \ - 'node fixed-threadwork.js' \ - 'node fixed-microjob.js' \ - 'node fixed-worker-threads-pool.js' +case "$OSTYPE" in + darwin*) + caffeinate ./hyperfine_benchmarks.sh + ;; + linux*) + systemd-inhibit ./hyperfine_benchmarks.sh + ;; + *) + echo "Unsupported $OSTYPE" + ;; +esac