Gunnar R|nning wrote:
> I think we can improve the performance of the JDBC driver alot still.
> ... The remaining largest bottleneck in my JDBC codebase now is related to
> byte/char conversions in the Sun JDK implementation. My profiler tells me
> that Sun JDK 1.2.2 for some reasons create new instances of the converter
> class every time you do an conversion...
A custom converter may not really help; I experimented with that for
another project and it really didn't make that big of a difference.
You might get some advantage by manually handling the converter object,
keeping a reference to it in the database handle so you don't have to
re-instantiate that class every time. That might help.
You might be able to optimize out some char-to-byte conversions.
For example, if someone "prepares" a SQL statement, you can pre-convert
the entire statement (less placeholders) into bytes, then
convert only the individual arguments; this would speed up
repeated uses of prepared statements. (I.e., break the original
statement
at ? placeholders, convert each block of static text into bytes,
store the statement as a list of byte[]. When someone executes
a statement, convert just the arguments into bytes and emit the
complete statement.) I've had very good luck with this strategy
for building and caching mostly-static web pages within Java servlets.
- Tim