Skip to content

Commit

Permalink
hyperfine: add sapling
Browse files Browse the repository at this point in the history
  • Loading branch information
polarhive committed May 18, 2024
1 parent e9a488c commit 7ecc160
Showing 1 changed file with 36 additions and 9 deletions.
45 changes: 36 additions & 9 deletions test/bench.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,38 @@ fi

# cloning candidates
echo "clone SSGs"
git clone https://github.com/acmpesuecc/anna /tmp/bench/anna
git clone https://github.com/anirudhRowjee/saaru /tmp/bench/saaru
git clone --depth=1 https://github.com/acmpesuecc/anna /tmp/bench/anna
git clone --depth=1 https://github.com/anirudhRowjee/saaru /tmp/bench/saaru
git clone --depth=1 https://github.com/NavinShrinivas/sapling /tmp/bench/sapling

# copy benchmark file
cp /tmp/bench/anna/site/content/posts/bench.md /tmp/bench/test.md

# build saaru & anna
echo "build SSGs"
cd /tmp/bench/anna && go build && cd ..
cd saaru && cargo build --release && mv ./target/release/saaru . && cd ..
cd /tmp/bench/anna && go build && cd /tmp/bench

# build rust based SSGs (comment this block if you already have these installed)
# sapling
cd /tmp/bench/sapling && cargo build --release
sudo rm -rf /usr/local/src/sapling
sudo mkdir -p /usr/local/src/sapling
sudo cp -r /tmp/bench/sapling/* /usr/local/src/sapling/
cd /usr/local/src/sapling
sudo mkdir -p /usr/local/bin/
sudo rm -rf /usr/local/bin/sapling
sudo ln -sf /usr/local/src/sapling/target/release/sapling /usr/local/bin/sapling
sudo chmod +x /usr/local/bin/sapling

# saaru
cd /tmp/bench/saaru && cargo build --release
sudo rm -rf /usr/local/src/saaru
sudo mkdir -p /usr/local/src/saaru
sudo cp -r /tmp/bench/saaru/* /usr/local/src/saaru/
cd /usr/local/src/saaru
sudo mkdir -p /usr/local/bin/
sudo rm -rf /usr/local/bin/saaru
sudo ln -sf /usr/local/src/saaru/target/release/saaru /usr/local/bin/saaru
sudo chmod +x /usr/local/bin/saaru

## setup hugo
hugo new site /tmp/bench/hugo; cd /tmp/bench/hugo
Expand All @@ -45,6 +67,7 @@ mkdir /tmp/bench/11ty -p
echo "Cleaning content directories"
rm -rf /tmp/bench/anna/site/content/posts/*
rm -rf /tmp/bench/saaru/docs/src/*
rm -rf /tmp/bench/sapling/benchmark/content/blog/*
rm -rf /tmp/bench/hugo/content/*
rm -rf /tmp/bench/11ty/*

Expand All @@ -53,6 +76,7 @@ echo "Spawning $files different markdown files..."
for ((i = 0; i < files; i++)); do
cp /tmp/bench/test.md "/tmp/bench/anna/site/content/posts/test_$i.md"
cp /tmp/bench/test.md "/tmp/bench/saaru/docs/src/test_$i.md"
cp /tmp/bench/test.md "/tmp/bench/sapling/benchmark/content/blogs/test_$i.md"
cp /tmp/bench/test.md "/tmp/bench/hugo/content/test_$i.md"
cp /tmp/bench/test.md "/tmp/bench/11ty/test_$i.md"
done
Expand All @@ -61,8 +85,11 @@ done
echo -e "\n"
echo "running benchmark: $files md files and $warm warmup runs"
echo -e "\n"
cd /tmp/bench/11ty && hyperfine -p 'sync' -w $warm "npx @11ty/eleventy" && cd ..
cd /tmp/bench/hugo && hyperfine -p 'sync' -w $warm "hugo" && cd .
cd /tmp/bench/saaru && hyperfine -p 'sync' -w $warm "./saaru --base-path ./docs" && cd ..
cd /tmp/bench/anna && hyperfine -p 'sync' -w $warm "./anna" && cd ..
hyperfine -p 'sync' -w $warm \
"cd /tmp/bench/11ty && npx @11ty/eleventy" \
"cd /tmp/bench/hugo && hugo" \
"cd /tmp/bench/anna && ./anna"
"cd /tmp/bench/saaru && saaru --base-path ./docs" \
"cd /tmp/bench/sapling/benchmark && sapling run" \
echo -e "\n"

0 comments on commit 7ecc160

Please sign in to comment.