]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
perf: release the GIL in copy-related libpq functions
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 26 Mar 2022 00:18:05 +0000 (01:18 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 26 Mar 2022 01:11:41 +0000 (02:11 +0100)
Tests have shown that these functions may do a considerable amount of
work, although purely CPU.

psycopg_c/psycopg_c/pq/libpq.pxd

index b554ff365c01abc933fbaa9973864cb69f2be713..2f69e2fd1a240df26761e3f4b0616796a6a3c51c 100644 (file)
@@ -253,9 +253,9 @@ cdef extern from "libpq-fe.h":
     PGnotify *PQnotifies(PGconn *conn) nogil
 
     # 33.9. Functions Associated with the COPY Command
-    int PQputCopyData(PGconn *conn, const char *buffer, int nbytes)
-    int PQputCopyEnd(PGconn *conn, const char *errormsg)
-    int PQgetCopyData(PGconn *conn, char **buffer, int async)
+    int PQputCopyData(PGconn *conn, const char *buffer, int nbytes) nogil
+    int PQputCopyEnd(PGconn *conn, const char *errormsg) nogil
+    int PQgetCopyData(PGconn *conn, char **buffer, int async) nogil
 
     # 33.10. Control Functions
     void PQtrace(PGconn *conn, FILE *stream);