1 message in org.postgresql.pgsql-jdbcQuery parsing speedup patch
FromSent OnAttachments
Mikko TiihonenJul 25, 2006 12:34 pm.patch, .java
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Query parsing speedup patchActions...
From:Mikko Tiihonen (mok@elisanet.fi)
Date:Jul 25, 2006 12:34:38 pm
List:org.postgresql.pgsql-jdbc
Attachments:

Hi,

I spent one day trying to to optimise the parsing of ResultSets from the stream. The attached patch gives around 35% speedup when parsing larger queries containing equal amount of int4, int8 or varchar columns assuming the system is CPU bound. I think parsing of other field types could be similarly optimised.

I also attached the test code which I used to test the performance.

VisibleBufferedInputStream - from scratch implementation that replaces BufferedInputStream * not synchronised * allows direct access to the buffer[] avoiding useless copies when converting to String * has method for scanning the length of next null terminated string

PGStream: - uses VisibleBuffereInputStream * faster implementations for for ReceiveIntegerR and ReceiveString

Encoding, AbstractJdbc2ResultSet - parses int and long values directly from byte[] -> number instead of first creating a throw-away string

Also, what would you think of patches that change all Vectors to ArrayList and Hashtables to HashMaps? The difference is not too visible when benchmarking with one thread and CPU but I believe that in larger machines the useless synchronisation can slow down the system by flushing the CPU write buffers. Also JIT could more freely modify the code when there are less synchronisation points.