1
0
mirror of https://github.com/venthur/blag.git synced 2025-11-26 05:02:58 +00:00

Compare commits

..

7 Commits

Author SHA1 Message Date
Bastian Venthur
f707f33fbc make linter happy 2025-07-18 11:58:35 +02:00
Bastian Venthur
3c617acfaf Merge branch 'master' into performance 2025-07-18 09:39:48 +02:00
Bastian Venthur
c94f9793b0 improved performance test 2025-01-22 14:46:14 +01:00
Bastian Venthur
5cddb62603 Merge branch 'master' into performance 2025-01-22 14:14:46 +01:00
Bastian Venthur
a3da95ea19 added benchmark 2024-10-29 12:13:05 +01:00
Bastian Venthur
c4f3c09730 WIP 2024-10-29 10:16:48 +01:00
Bastian Venthur
5943dab690 wip 2024-10-29 10:16:48 +01:00
4 changed files with 52 additions and 10 deletions

View File

@@ -18,11 +18,10 @@ jobs:
- "3.11"
- "3.12"
- "3.13"
- "3.14"
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
@@ -35,8 +34,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
@@ -49,8 +48,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
@@ -64,8 +63,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"

View File

@@ -2,7 +2,6 @@
## [unreleased] --
* Added Python 3.14 compatibility
* Removed requirements.txt and requirements-dev.txt
## [2.3.3] -- 2025-04-27

View File

@@ -63,6 +63,10 @@ serve-docs: $(VENV)
manpage: $(VENV)
help2man $(BIN)/blag --no-info -n "blog-aware, static site generator" -o debian/blag.1
.PHONY: benchmark
benchmark: $(VENV)
$(BIN)/pytest --no-cov -s -rP tests/benchmark.py
.PHONY: clean
clean:
rm -rf build dist *.egg-info

40
tests/benchmark.py Normal file
View File

@@ -0,0 +1,40 @@
"""Benchmark for Blag."""
import os
from argparse import Namespace
import blag
from blag.blag import build
def test_performance(args: Namespace) -> None:
"""Test performance.
This test checks how quickly blag can generate `FILES` amount of pages from
markdown.
"""
FILES = 1000
print(f"Generating {FILES} files")
# create random markdown files in the content directory
with open(os.path.join(blag.__path__[0], "content", "testpage.md")) as fh:
markdown = fh.read()
for i in range(FILES):
with open(f"content/{i}.md", "w") as f:
f.write(markdown)
f.write(str(i))
from time import time
t = time()
build(args)
t_first = time() - t
print(t_first)
t = time()
build(args)
t_second = time() - t
print(t_second)
print(f"First run: {t_first:.2f}s, second run: {t_second:.2f}s")
print(f"Speedup: {t_first/t_second:.2f}")