[DB-SIG] pypg pure Python db driver for Postgresql

Randall Smith randall at tnr.cc
Wed Jul 13 16:21:59 CEST 2005

I haven't done any speed optimization or even profiled the code, so that 
looks really good to me.  I think optimization might help with parameter 
binding and type conversion.

Did your tests include parameters?

Could you run your tests against PyGreSQL from which pypg is derived? 
That would show a clearer picutre of the speed difference between 
C/Python for this application.


Stephane Bortzmeyer wrote:
> On Tue, Jul 12, 2005 at 11:41:43PM -0500,
>  Randall Smith <randall at tnr.cc> wrote 
>  a message of 52 lines which said:
>>I put in ident support and Unix socket support as well as taking the
>>username from the process when it is not specified.
> OK, it works much better now.
> Performance tests can be done and they seem to show that pypg is
> slower but you may decide by yourself if it is *too* slow:
> % python test.py                       
> Result with <module 'psycopg' from '/usr/lib/python2.3/site-packages/psycopgmodule.so'>
> 100 repetitions:
> INSERT: 0.4 msec/pass
> SELECT (with join): 0.6 msec/pass
> DELETE: 0.3 msec/pass
> % python test.py                       
> Result with <module 'pypg' from '/usr/local/lib/python2.3/site-packages/pypg/__init__.pyc'>
> 100 repetitions:
> INSERT: 0.7 msec/pass
> SELECT (with join): 1.1 msec/pass
> DELETE: 0.6 msec/pass

More information about the DB-SIG mailing list