Skip to content

Commit

Permalink
feat: Add benchmark script, still WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverRainZ committed Jul 7, 2024
1 parent 37d93ad commit 5864ec1
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions utils/bench.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/sh

# set -x
set -e

tmpdir=$(mktemp -d)
echo $tmpdir
cd $tmpdir

python --version
python -m venv .
source ./bin/activate

python -m pip install sphinx==v7.3.7 sphinxnotes-fasthtml >/dev/null
pip show sphinx sphinxnotes-fasthtml

compare() {
echo "" >> index.rst
make SPHINXOPTS=-Q html
echo ">>> Fast build"
echo "Another line" >> index.rst
time make SPHINXOPTS=-Q fast
echo ">>> Standard build"
echo "Another line" >> index.rst
time make SPHINXOPTS=-Q html
}

echo "=== Sphinx"
git clone --quiet --branch v7.3.7 --depth 1 https://github.com/sphinx-doc/sphinx.git >/dev/null
cd sphinx/doc
echo "extensions.append('sphinxnotes.fasthtml')" >> conf.py
cat <<'EOF' >> Makefile
fast: Makefile
@$(SPHINXBUILD) -b fasthtml "$(SOURCEDIR)" "$(BUILDDIR)/html" $(SPHINXOPTS) $(O)
EOF
compare
cd ..

# rm -rf $tmpdir

0 comments on commit 5864ec1

Please sign in to comment.