diff options
| author | David Lord <davidism@gmail.com> | 2023-01-26 07:18:50 -0800 |
|---|---|---|
| committer | David Lord <davidism@gmail.com> | 2023-01-26 07:18:50 -0800 |
| commit | 45dbe44a36a2abe1b0b62b8ff9e32653fe91fb83 (patch) | |
| tree | 8469681beac3314ed3d660fdb6e3dd9f5a1ced95 /bench | |
| parent | 00fea0a771ed63169933684283862e50ff3497aa (diff) | |
| download | markupsafe-rust.tar.gz | |
initial rust implementationrust
Diffstat (limited to 'bench')
| -rw-r--r-- | bench/bench_basic.py | 5 | ||||
| -rw-r--r-- | bench/bench_largestring.py | 6 | ||||
| -rw-r--r-- | bench/bench_long_empty_string.py | 6 | ||||
| -rw-r--r-- | bench/bench_long_suffix.py | 6 | ||||
| -rw-r--r-- | bench/bench_short_empty_string.py | 5 | ||||
| -rw-r--r-- | bench/runbench.py | 38 |
6 files changed, 0 insertions, 66 deletions
diff --git a/bench/bench_basic.py b/bench/bench_basic.py deleted file mode 100644 index b67eda4..0000000 --- a/bench/bench_basic.py +++ /dev/null @@ -1,5 +0,0 @@ -from markupsafe import escape - - -def run(): - escape("<strong>Hello World!</strong>") diff --git a/bench/bench_largestring.py b/bench/bench_largestring.py deleted file mode 100644 index 9ced67f..0000000 --- a/bench/bench_largestring.py +++ /dev/null @@ -1,6 +0,0 @@ -from markupsafe import escape - - -def run(): - string = "<strong>Hello World!</strong>" * 1000 - escape(string) diff --git a/bench/bench_long_empty_string.py b/bench/bench_long_empty_string.py deleted file mode 100644 index ad2480c..0000000 --- a/bench/bench_long_empty_string.py +++ /dev/null @@ -1,6 +0,0 @@ -from markupsafe import escape - - -def run(): - string = "Hello World!" * 1000 - escape(string) diff --git a/bench/bench_long_suffix.py b/bench/bench_long_suffix.py deleted file mode 100644 index 35f38da..0000000 --- a/bench/bench_long_suffix.py +++ /dev/null @@ -1,6 +0,0 @@ -from markupsafe import escape - - -def run(): - string = "<strong>Hello World!</strong>" + "x" * 100000 - escape(string) diff --git a/bench/bench_short_empty_string.py b/bench/bench_short_empty_string.py deleted file mode 100644 index 0664a6f..0000000 --- a/bench/bench_short_empty_string.py +++ /dev/null @@ -1,5 +0,0 @@ -from markupsafe import escape - - -def run(): - escape("Hello World!") diff --git a/bench/runbench.py b/bench/runbench.py deleted file mode 100644 index f20cd49..0000000 --- a/bench/runbench.py +++ /dev/null @@ -1,38 +0,0 @@ -import os -import re -import sys -from subprocess import Popen - -_filename_re = re.compile(r"^bench_(.*?)\.py$") -bench_directory = os.path.abspath(os.path.dirname(__file__)) - - -def list_benchmarks(): - result = [] - for name in os.listdir(bench_directory): - match = _filename_re.match(name) - if match is not None: - result.append(match.group(1)) - result.sort(key=lambda x: (x.startswith("logging_"), x.lower())) - return result - - -def run_bench(name): - print(name) - Popen( - [sys.executable, "-m", "timeit", "-s", f"from bench_{name} import run", "run()"] - ).wait() - - -def main(): - print("=" * 80) - print("Running benchmark for MarkupSafe") - print("-" * 80) - os.chdir(bench_directory) - for bench in list_benchmarks(): - run_bench(bench) - print("-" * 80) - - -if __name__ == "__main__": - main() |
