Skip to content

Instantly share code, notes, and snippets.

@samuelcolvin
Last active September 25, 2026 13:01
Show Gist options
  • Select an option

  • Save samuelcolvin/f48e60a983264c5b4d6132978f59be1e to your computer and use it in GitHub Desktop.

Select an option

Save samuelcolvin/f48e60a983264c5b4d6132978f59be1e to your computer and use it in GitHub Desktop.
# /// 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