Last active
September 25, 2026 13:01
-
-
Save samuelcolvin/f48e60a983264c5b4d6132978f59be1e 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.14" | |
| # dependencies = ["pydantic-monty>=1"] | |
| # /// | |
| import time | |
| from pydantic_monty import Monty | |
| N = 10_000 | |
| with Monty() as pool: | |
| start = time.perf_counter() | |
| for _ in range(N): | |
| with pool.checkout() as session: | |
| result = session.feed_run('1+1') | |
| elapsed = time.perf_counter() - start | |
| print(f'{N} sessions: {elapsed * 1000:.3f}ms total, {elapsed / N * 1000:.3f}ms per session') | |
| #> 10000 sessions: 683.706ms total, 0.068ms per session |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment