Skip to content

Commit

Permalink
update bench script
Browse files Browse the repository at this point in the history
use pyperf instead of timeit
remove individual scripts
  • Loading branch information
davidism committed Apr 17, 2024
1 parent 8902171 commit 31d9b66
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 66 deletions.
26 changes: 26 additions & 0 deletions bench.py
@@ -0,0 +1,26 @@
import subprocess
import sys

for name, s in (
("short escape", '"<strong>Hello, World!</strong>"'),
("long escape", '"Hello, World!" * 1000'),
("short plain", '"Hello, World!"'),
("long plain", '"Hello, World!" * 1000'),
("long suffix", '"<strong>Hello, World!</strong>" + "x" * 100_000'),
):
for mod in "native", "speedups":
subprocess.run(
[
sys.executable,
"-m",
"pyperf",
"timeit",
"--append",
"bench-results.json",
"--name",
f"{name} {mod}",
"-s",
f"from markupsafe._{mod} import escape\ns = {s}",
"escape(s)",
]
)
5 changes: 0 additions & 5 deletions bench/bench_basic.py

This file was deleted.

6 changes: 0 additions & 6 deletions bench/bench_largestring.py

This file was deleted.

6 changes: 0 additions & 6 deletions bench/bench_long_empty_string.py

This file was deleted.

6 changes: 0 additions & 6 deletions bench/bench_long_suffix.py

This file was deleted.

5 changes: 0 additions & 5 deletions bench/bench_short_empty_string.py

This file was deleted.

38 changes: 0 additions & 38 deletions bench/runbench.py

This file was deleted.

0 comments on commit 31d9b66

Please sign in to comment.