| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | ### The -t argument is needed to specify the type of task that you want to benchmark. |
| 4 | ### Supported values are CPU_INTENSIVE |
| 5 | |
| 6 | taskType='CPU_INTENSIVE' |
| 7 | while getopts t: flag |
| 8 | do |
| 9 | case "${flag}" in |
| 10 | t) |
| 11 | taskType=${OPTARG} |
| 12 | ;; |
| 13 | esac |
| 14 | done |
| 15 | |
| 16 | echo 'Running bench for task type:' $taskType |
| 17 | export TASK_TYPE=$taskType |
| 18 | # Execute bench |
| 19 | export NODE_ENV=production |
| 20 | export POOL_SIZE=10 |
| 21 | export NUM_ITERATIONS=100000 |
| 22 | case "$OSTYPE" in |
| 23 | darwin*) |
| 24 | caffeinate ./hyperfine_benchmarks.sh |
| 25 | ;; |
| 26 | linux*) |
| 27 | systemd-inhibit ./hyperfine_benchmarks.sh |
| 28 | ;; |
| 29 | *) |
| 30 | echo "Unsupported $OSTYPE" |
| 31 | ;; |
| 32 | esac |