Took out logging calls, found after doing some profiling that the hit is pretty significant.
1.1 --- a/bpgsql.py Wed Sep 17 20:43:35 2008 -0500
1.2 +++ b/bpgsql.py Sat Sep 20 11:10:29 2008 -0500
1.3 @@ -21,7 +21,6 @@
1.4 import datetime
1.5 import errno
1.6 import exceptions
1.7 -import logging
1.8 import re
1.9 import select
1.10 import socket
1.11 @@ -255,9 +254,6 @@
1.12 # Helper classes and functions
1.13 #
1.14
1.15 -BPGSQL_LOGGER = logging.getLogger('bpgsql')
1.16 -
1.17 -
1.18 def _parseDSN(s):
1.19 """
1.20 Parse a string containing PostgreSQL libpq-style connection info in the form:
1.21 @@ -553,8 +549,6 @@
1.22 #
1.23 # Read the specified number of bytes from the backend
1.24 #
1.25 - BPGSQL_LOGGER.debug('__read_bytes(%d)' % nBytes)
1.26 -
1.27 while len(self.__input_buffer) < nBytes:
1.28 d = self.__recv(4096)
1.29 if d:
1.30 @@ -594,12 +588,8 @@
1.31 # method looks up a method named _pkt_<c> and calls that
1.32 # to handle the response
1.33 #
1.34 - BPGSQL_LOGGER.debug('>[%s]' % self.__input_buffer)
1.35 -
1.36 pkt_type = self.__read_bytes(1)
1.37
1.38 - BPGSQL_LOGGER.debug('pkt_type: %s' % pkt_type)
1.39 -
1.40 method = self.__class__.__dict__.get('_pkt_' + pkt_type, None)
1.41 if method:
1.42 method(self)
1.43 @@ -675,8 +665,6 @@
1.44 #
1.45 # Send data to the backend, make sure it's all sent
1.46 #
1.47 - BPGSQL_LOGGER.debug('Send [%s]' % data)
1.48 -
1.49 if self.__socket is None:
1.50 raise InterfaceError, 'Connection not open'
1.51
1.52 @@ -805,7 +793,7 @@
1.53 #
1.54 # EmptyQuery Response
1.55 #
1.56 - BPGSQL_LOGGER.debug('Empty Query: %s' % self.__read_string())
1.57 + pass
1.58
1.59
1.60 def _pkt_K(self):
1.61 @@ -821,7 +809,6 @@
1.62 # Notice Response
1.63 #
1.64 n = self.__read_string()
1.65 - BPGSQL_LOGGER.debug('Notice: %s' % n)
1.66 self.__current_result.messages.append((Warning, n))
1.67
1.68
1.69 @@ -942,8 +929,6 @@
1.70 if type(cmd) == types.UnicodeType:
1.71 cmd = cmd.encode('utf-8')
1.72
1.73 - BPGSQL_LOGGER.debug('EXECUTE:' + expanded_cmd)
1.74 -
1.75 self.__ready = 0
1.76 self.__result = None
1.77 self.__new_result()
1.78 @@ -1036,8 +1021,6 @@
1.79 ints or strings.
1.80
1.81 """
1.82 - BPGSQL_LOGGER.debug('funcall %s %s' % (self.__lo_funcnames.get(oid, str(oid)), str(args)))
1.83 -
1.84 self.__ready = 0
1.85 self.__send(_pack('!2sIi', 'F\0', oid, len(args)))
1.86 for arg in args: