From 21297d053a9136e64ddef113c711d11f4ef0f000 Mon Sep 17 00:00:00 2001 From: Wilson Lin Date: Sun, 8 Aug 2021 21:23:53 +1000 Subject: [PATCH] Refactoring --- bench/{build.sh => build} | 4 ++++ bench/{bench.sh => run} | 10 ++++++++-- bench/runners/minify-html (Rust)/Cargo.toml | 2 +- bench/runners/minify-html-onepass (Rust)/Cargo.toml | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) rename bench/{build.sh => build} (82%) mode change 100644 => 100755 rename bench/{bench.sh => run} (64%) diff --git a/bench/build.sh b/bench/build old mode 100644 new mode 100755 similarity index 82% rename from bench/build.sh rename to bench/build index c7ab5a7..f6acb33 --- a/bench/build.sh +++ b/bench/build @@ -4,6 +4,8 @@ set -Eeuo pipefail shopt -s nullglob +pushd "$(dirname "$0")" >/dev/null + pushd runners >/dev/null for r in *; do if [ ! -d "$r" ]; then @@ -16,4 +18,6 @@ for r in *; do done popd >/dev/null +popd >/dev/null + echo "All done!" diff --git a/bench/bench.sh b/bench/run similarity index 64% rename from bench/bench.sh rename to bench/run index 09b9024..8e7cb5b 100755 --- a/bench/bench.sh +++ b/bench/run @@ -4,13 +4,17 @@ set -Eeuo pipefail shopt -s nullglob +pushd "$(dirname "$0")" >/dev/null + for i in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo performance | sudo dd status=none of="$i" done results_dir="$PWD/results" input_dir="$PWD/inputs" -iterations=1 +iterations=${MHB_ITERATIONS:-100} + +mkdir -p "$results_dir" pushd runners >/dev/null for r in *; do @@ -20,9 +24,11 @@ for r in *; do echo "Running $r..." pushd "$r" >/dev/null out="$results_dir/$r.json" - sudo --preserve-env=MHB_HTML_ONLY,PATH MHB_ITERATIONS=$iterations MHB_INPUT_DIR="$input_dir" nice -n -20 taskset -c 1 ./run > "$out" + sudo --preserve-env=MHB_HTML_ONLY,PATH MHB_ITERATIONS="$iterations" MHB_INPUT_DIR="$input_dir" nice -n -20 taskset -c 1 ./run >"$out" popd >/dev/null done popd >/dev/null +popd >/dev/null + echo "All done!" diff --git a/bench/runners/minify-html (Rust)/Cargo.toml b/bench/runners/minify-html (Rust)/Cargo.toml index 970ba53..65a09f7 100644 --- a/bench/runners/minify-html (Rust)/Cargo.toml +++ b/bench/runners/minify-html (Rust)/Cargo.toml @@ -6,7 +6,7 @@ authors = ["Wilson Lin "] edition = "2018" [dependencies] -minify-html = { path = "../../../rust/main" } +minify-html = { path = "../../../rust/main", features = ["js-esbuild"] } serde = { version = "1.0.104", features = ["derive"] } serde_json = "1.0.44" diff --git a/bench/runners/minify-html-onepass (Rust)/Cargo.toml b/bench/runners/minify-html-onepass (Rust)/Cargo.toml index 485dafc..9c8ba4c 100644 --- a/bench/runners/minify-html-onepass (Rust)/Cargo.toml +++ b/bench/runners/minify-html-onepass (Rust)/Cargo.toml @@ -6,6 +6,6 @@ authors = ["Wilson Lin "] edition = "2018" [dependencies] -minify-html-onepass = { path = "../../../rust/onepass" } +minify-html-onepass = { path = "../../../rust/onepass", features = ["js-esbuild"] } serde = { version = "1.0.104", features = ["derive"] } serde_json = "1.0.44"