4 ms·
Asyncpg isn't pure Python, if that's what you mean by native. It's a heavy user of Python's C API, which is why PyPy can't run it. But yes, Asyncpg does tend to
by FreakLegion 3y ago
Asyncpg isn't pure Python, if that's what you mean by native. It's a heavy user of Python's C API, which is why PyPy can't run it. But yes, Asyncpg does tend to be quite a bit faster than Psycopg2 in most cases.
- andrewstuart 3y agoOK I was wrong and stand corrected, asyncpg is not pure Python. asyncpg has these two C files and also uses Cython as far as I can see. https://github.com/MagicStack/asyncpg/blob/master/asyncpg/protocol/record/recordobj.c https://github.com/MagicStack/asyncpg/blob/master/asyncpg/pr... https://github.com/MagicStack/asyncpg/blob/master/asyncpg/protocol/record/recordobj.h https://github.com/MagicStack/asyncpg/blob/master/asyncpg/pr... If you are interested here is a post by the psycopg author about psycopg2 and 3 and performance versus asyncpg. https://www.varrazzo.com/blog/2020/05/19/a-trip-into-optimisation/ https://www.varrazzo.com/blog/2020/05/19/a-trip-into-optimis...