From a3da95ea19387b77f0fe9462b11984fd8c7443eb Mon Sep 17 00:00:00 2001 From: Bastian Venthur Date: Tue, 29 Oct 2024 12:13:05 +0100 Subject: [PATCH] added benchmark --- tests/benchmark.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/benchmark.py diff --git a/tests/benchmark.py b/tests/benchmark.py new file mode 100644 index 0000000..63a5aa2 --- /dev/null +++ b/tests/benchmark.py @@ -0,0 +1,30 @@ +import os + +import blag +from blag.blag import build + + +def test_performance(args) -> None: + # create 1000 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(10000): + with open(f"content/{i}.md", "w") as f: + f.write(markdown) + f.write(str(i)) + + from time import time + + t = time() + build(args) + print(time() - t) + + import cProfile + + t = time() + #cProfile.run("build(args)") + build(args) + print(time() - t) + + + 1 / 0