Created
December 2, 2025 07:08
-
-
Save kolibril13/3aed7fef7d1ebfc4fbc94d4947c65f58 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /// script | |
| # requires-python = ">=3.12" | |
| # dependencies = [ | |
| # "uvtrick", | |
| # ] | |
| # /// | |
| from uvtrick import Env | |
| def benchmark(): | |
| import time | |
| import sys | |
| version = sys.version_info | |
| print(f"Running benchmark with Python {version.major}.{version.minor}") | |
| total = 0 | |
| N = 200_000_000 | |
| start = time.time() | |
| for i in range(N): | |
| total = total+i | |
| duration = time.time() - start | |
| print(f"Adding {N} elements took {duration:.2f} seconds.\n") | |
| print("Starting benchmark tests:") | |
| Env(python="3.11").run(benchmark) | |
| Env(python="3.12").run(benchmark) | |
| Env(python="3.13").run(benchmark) | |
| Env(python="3.14").run(benchmark) | |
Author
kolibril13
commented
Dec 2, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment