bazzite/docs/utils/benchmark.sh
Zeglius 73ebc95f8b
docs: Transcribe docs to github (#1602)
* docs: Add new transcribe script

* chore(docs): Add usage help to transcribe.py

* chore(docs): Add file argument requirement to transcribe.py

* chore(docs): Move transcribe.py usage example to bottom

* chore(docs): Replace transcribe.py stdout separator with tab

* chore(docs): Major optimizations for fetch_discourse_md.py

Now is 2x faster

* chore(docs): Add docs build benchmark script

* chore(docs): Separate url mappings in its own yaml file

* chore(docs): Remove outdated fetch_discourse_md.py docs

* chore(docs): Apply default empty url_mapping if url_overrides.yml is not pressent

* chore(docs): Add log message to cmdrun.py when url_overrides.yml is not found

* chore(docs): Exclude leftover heading from raw markdown

* docs: Transcribe docs to github

* docs: Fix distrobox package managers table

* docs: Format distrobox article

Decrease headings hierarchy across all the article

* docs: Remove duplicate automounting guides
2024-09-03 19:55:40 +00:00

33 lines
741 B
Bash
Executable File

#!/usr/bin/env bash
set -eo pipefail
if ! command -v hyperfine >&2 2>/dev/null; then
echo >&2 "This script requires 'hyperfine'"
exit 1
fi
cd "$(dirname "${0}")" || exit
# Store current and previous commit hashes
_commit_1_ref=$(git rev-parse "${1:-HEAD~1}")
_commit_2_ref=$(git rev-parse "${2:-HEAD}")
orig_ref=$(git rev-parse --abbrev-ref HEAD)
readonly orig_ref
commit_1=$(git rev-parse "$_commit_1_ref")
commit_2=$(git rev-parse "$_commit_2_ref")
# shellcheck disable=SC2064
trap "git checkout ${orig_ref}" INT EXIT
# Run benchmark
hyperfine \
--runs 3 \
--parameter-list ref "${commit_1}","${commit_2}" \
--setup 'git checkout --quiet -d {ref}' \
\
'just mkdocs build' \
\
'just mkdocs build'