You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When run on different versions (0.30.0 vs 0.31.0), the following script reproduces the issue and consistently shows a performance regression of approximately 22%:
importasyncioimportasyncpgimporttimeCOUNT=5_000asyncdefrun():
conn=awaitasyncpg.connect("postgresql://user:password@localhost/postgres")
awaitconn.execute("CREATE TABLE IF NOT EXISTS users (id SERIAL PRIMARY KEY, username TEXT, email TEXT, age INT)")
RECORDS= [("John Doe", "john.doe@example.com", 42)] *10_000start=time.perf_counter()
for_inrange(COUNT):
awaitconn.copy_records_to_table("users", records=RECORDS, columns=["username", "email", "age"])
end=time.perf_counter()
awaitconn.close()
returnend-startif__name__=="__main__":
total=asyncio.run(run())
print(f"Total time: {total:.5f} seconds")
print(f"Average time per loop: {total/COUNT:.8f} seconds")
(common) [e.lee@OC0000842]$ pip install asyncpg==0.30.0
(common) [e.lee@OC0000842]$ python -m example
Total time: 89.15468 seconds
Average time per loop: 0.01783094 seconds
(common) [e.lee@OC0000842]$ pip install asyncpg==0.31.0
(common) [e.lee@OC0000842]$ python -m example
Total time: 108.57080 seconds
Average time per loop: 0.02171416 seconds
When run on different versions (0.30.0 vs 0.31.0), the following script reproduces the issue and consistently shows a performance regression of approximately 22%: