diff options
| author | Christian Tismer <tismer@stackless.com> | 2025-02-07 15:08:24 +0100 |
|---|---|---|
| committer | Christian Tismer <tismer@stackless.com> | 2025-02-07 23:17:55 +0100 |
| commit | d7756f432f86b9e28addcce017dfcb141fd8a30a (patch) | |
| tree | c86f480be0597e385e0bdce76eda1e8b3284897a /sources/pyside6/tests | |
| parent | 8f768500107b0fae5957e5f8ee007f5798db2fc3 (diff) | |
binary size: Update the benchmark tool to absolute measurement
After sizebench.py was used successfully on relative changes
(with a disable switch in the code), we now add an absolute
mode. This way, we can stop to support switching.
The starting point is 2025-01-27 right before a substantial
change which is otherwise not measurable.
The new mode is activated with --absolute / -a
It works much faster since it compares against a constant.
Task-number: PYSIDE-2701
Change-Id: I341a23722a304473e92f8ef38c6d16b3b69a8a92
Pick-to: 6.8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6/tests')
| -rw-r--r-- | sources/pyside6/tests/manually/sizebench.py | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/sources/pyside6/tests/manually/sizebench.py b/sources/pyside6/tests/manually/sizebench.py index dea40449f..7dc54d597 100644 --- a/sources/pyside6/tests/manually/sizebench.py +++ b/sources/pyside6/tests/manually/sizebench.py @@ -16,6 +16,10 @@ No argument: Use a default Python for each platform (author specific). --python <python> use that specific python interpreter --dry-run try it first without compilation --pip automatically install the needed modules + --absolute compare against the status from + b887919ea244a057f15be9c1cdc652538e3fe9a0 + Yocto: allow LLVM 14 for building PySide + 2025-01-23 18:18 """ import argparse import os @@ -27,10 +31,17 @@ import sys from ast import literal_eval from pathlib import Path + defaults = { - "Darwin": "/Users/tismer/.pyenv/versions/3.12.5/bin/python3", - "Windows": "d:/py312_64/python.exe", - "Linux": "/home/ctismer/.pyenv/versions/3.12.5/bin/python3", + "Darwin": "/Users/tismer/.pyenv/versions/3.12.5/bin/python3", # noqa: E241 + "Windows": "d:/py312_64/python.exe", # noqa: E241 + "Linux": "/home/ctismer/.pyenv/versions/3.12.5/bin/python3", # noqa: E241 +} + +reference = { + "Darwin": 26165741, # noqa: E241 + "Windows": 15324160, # noqa: E241 + "Linux": 19203176, # noqa: E241 } @@ -103,6 +114,8 @@ if __name__ == "__main__": parser.add_argument("--dry-run", "-d", action="store_true") parser.add_argument("--pip", action="store_true", help=""" Install the necessary modules automatically, which can save some trouble""") + parser.add_argument("--absolute", "-a", action="store_true", help=""" + Measure against the state on 2025-01-23""") args = parser.parse_args() python = args.python or defaults[plat] if plat in defaults else args.python @@ -126,12 +139,15 @@ if __name__ == "__main__": subprocess.run([python, "-m", "pip", "install"] + needs_imports) skip = args.dry_run - cmd = [python] + options_base - if not skip: - subprocess.run(cmd) + if args.absolute: + res_base = reference[plat] + else: + cmd = [python] + options_base + if not skip: + subprocess.run(cmd) - build_dir = get_build_dir() - res_base = get_result_size(build_dir) + build_dir = get_build_dir() + res_base = get_result_size(build_dir) cmd = [python] + options_best if not skip: @@ -140,10 +156,11 @@ if __name__ == "__main__": build_dir = get_build_dir() res_best = get_result_size(build_dir) + add_text = " on 2025-01-27" if args.absolute else "" print() print(f"Compiling with {python}") print(f"Platform = {plat}") - print(f"base size = {res_base}") + print(f"base size = {res_base}{add_text}") print(f"best size = {res_best}") print(f"improvement {(res_base - res_best) / res_base:%}") if skip: |
