date: 2026-11-05T21:00:39.258060+00:00 commit: 57744c532c58d3e2bd248b4368ecba0a42402ed8 Local microbenchmark, not HTTP throughput. Private compilation API used only for diagnosis. $ .venv/bin/python - <<'PY' from timeit import timeit from sqlalchemy.dialects.postgresql.asyncpg import dialect from messenger.messaging.infrastructure.postgres import POST_MESSAGE, post_message import sqlalchemy raw = post_message() cached = POST_MESSAGE d = dialect() assert str(raw.compile(dialect=d)) == str(cached.compile(dialect=d)) assert raw._generate_cache_key() is None assert cached._generate_cache_key() is not None print("SQLAlchemy", sqlalchemy.__version__, "identical SQL; baseline has no cache key") for repeat in range(1, 4): for label, statement in [("before", raw), ("after", cached)]: cache = {} elapsed = timeit(lambda: statement._compile_w_cache(d, compiled_cache=cache, column_keys=[]), number=1000) print(repeat, label, "1000 compilations seconds", round(elapsed, 6), "cache entries", len(cache)) PY SQLAlchemy 2.0.45 identical SQL; baseline has no cache key 1 before 1000 compilations seconds 0.337964 cache entries 0 1 after 1000 compilations seconds 0.000546 cache entries 1 2 before 1000 compilations seconds 0.338064 cache entries 0 2 after 1000 compilations seconds 0.000538 cache entries 1 3 before 1000 compilations seconds 0.335619 cache entries 0 3 after 1000 compilations seconds 0.000565 cache entries 1 exit: 0