pg.ddx.io  psycopg/psycopg GitHub issues and pull requests  
help / color / mirror / Atom feed
From: Alexkane (@Alexkane) <noreply+Alexkane@github.com>
To: psycopg/psycopg <noreply+psycopg-psycopg@github.com>
Subject: [psycopg/psycopg] PR #1469: perf: don't wait on the event loop when the socket is writable
Date: Fri, 30 Oct 2026 07:14:41 +0000
Message-ID: <gh-psycopg-psycopg-1469@github.com> (raw)

Fix #1468.

When the generator asks to write, poll the fd with zero timeout before registering with the loop, and feed the generator at once if it's ready. Waits for reading only are unchanged.

Localhost: `executemany()` 50k rows 1.61 → 0.37 s (sync: 0.39), pipelined `execute()` 34 → 9.5 µs, `copy()` one `write()` per row 0.60 → 0.27 s. Round trips, copy-out, fetch-all and idle CPU unchanged.

Added `copy-in` and `pipeline` workloads to `waittest.py` (copy-in 1252 → 510 ms, pipeline 71 → 18 ms) and `test_wait_w_no_loop`.


view thread (11+ messages)  latest in thread

Message-ID: <gh-psycopg-psycopg-1469@github.com>
Permalink:  ../gh-psycopg-psycopg-1469@github.com/

 · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox