-
-
Save ianchanning/80a7ab6856611c7c7c7fa5047a27a2f4 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