From fae18af6b4fae44f70212c0a5b4657e90fd343f3 Mon Sep 17 00:00:00 2001 From: acheronfail Date: Thu, 14 Dec 2023 13:19:27 +1030 Subject: [PATCH] add ruby --- count.rb | 6 ++++++ justfile | 12 ++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 count.rb diff --git a/count.rb b/count.rb new file mode 100644 index 0000000..882f469 --- /dev/null +++ b/count.rb @@ -0,0 +1,6 @@ +i = 0 +while i < 1_000_000_000 do + i += 1 +end + +print i \ No newline at end of file diff --git a/justfile b/justfile index b86a5fb..0cfdeb1 100644 --- a/justfile +++ b/justfile @@ -26,6 +26,7 @@ build: prepare rustc -C opt-level=3 ./count.rs -o {{b}}/rust javac count.java echo "#!/usr/bin/env -S java count" > {{b}}/java + echo "#!/usr/bin/env -S ruby \n$(cat count.rb)" > {{b}}/ruby echo "#!/usr/bin/env -S python3 \n$(cat count.py)" > {{b}}/python3 echo "#!/usr/bin/env -S node \n$(cat count.js)" > {{b}}/node echo "#!/usr/bin/env -S deno run \n$(cat count.js)" > {{b}}/deno @@ -41,11 +42,14 @@ run: build name="$(basename $f)" out="{{r}}/${name}.json" - if [[ "$name" == *"python"* ]]; then - args="--runs 2" - else + case "$name" in + *"python"*|*"ruby"*) + args="--runs 2" + ;; + *) args="--warmup 3" - fi + ;; + esac hyperfine $args --shell=none --export-json "$out" "$f" jq '.results[0] | del(.exit_codes)' "$out" | sponge "$out"