Regression in copy records performance between 0.30.0 and 0.31.0
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- postgresql, python
- 领域
- databases, performance
调研方向
首先,使用 asyncpg 0.30.0 和 0.31.0 针对 PostgreSQL 运行提供的 asyncio 脚本,确认报告的 copy_records_to_table 耗时差异。跟踪 copy_records_to_table 的路径,以确定这些版本之间发生了什么变化;当回归问题得到解释且基准测试不再显示报告的性能下降时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
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%:
import asyncio
import asyncpg
import time
COUNT = 5_000
async def run():
conn = await asyncpg.connect("postgresql://user:password@localhost/postgres")
await conn.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_000
start = time.perf_counter()
for _ in range(COUNT):
await conn.copy_records_to_table("users", records=RECORDS, columns=["username", "email", "age"])
end = time.perf_counter()
await conn.close()
return end - start
if __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
- 主要语言
- Python
- 星标
- 8.1k
- 派生
- 469
- 平均合并
- 2 天 20 小时
- 30 天内合并 PR
- 9
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
MagicStack/asyncpg 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
MagicStack/asyncpg#1357 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
MagicStack/asyncpg#997 ·
-
难度 4/5 3-5 天 新手友好度 48/100
MagicStack/asyncpg#1354 ·
-
难度 3/5 1-2 天 新手友好度 72/100
MagicStack/asyncpg#1342 ·
-
难度 3/5 1-2 天 新手友好度 56/100
MagicStack/asyncpg#1340 · 1 条评论 ·
查看 MagicStack/asyncpg 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
ClickHouse/clickhouse-connect#1057 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 70/100
open-telemetry/sig-end-user#406 ·
-
bug ci good first issue
难度 2/5 1-3 小时 新手友好度 88/100