Subject RE: [Firebird-Java] Performance Tweak
Author Ken Richard
I also noticed that FBConnection.nativeSQL appears to be called twice
for each query. Once from:
executeQuery
internalExecute
isExecuteProcedureStatement

once from:
executeQuery
internalExecute
prepareFixedStatement

I realize that these may be insignificant but my app appears to be
spending about 20% of my time within FBConnection.prepareFixedStatement.
The environment is tomcat with firebird backend. Any suggestions?
There are some statements (stored procs) that are called often but only
once per servlet request. Is it possible to reuse statements across
connections? Or maybe cache common statements with a custom database
pool?

-----Original Message-----
From: Ken Richard [mailto:kenr@...]
Sent: Tuesday, May 27, 2003 1:38 PM
To: Firebird-Java@yahoogroups.com
Subject: [Firebird-Java] Performance Tweak


I am running a profiler (numega) against my code (tomcat servlets with
jaybird 1.0) and found something that may be a small benefit for
performance but is easy to fix.

getJavaEncodings in FBConnectionHelper is called often through the stack
FBResultSet constructor
prepareVars
FBField.setConnection
getJavaEncodings

and through a similar stack involving FBPreparedStatement constructor.

The getJavaEncodings calls getDefaultJavaEncodings which looks like:

public static String getDefaultJavaEncoding() {
InputStreamReader reader = new InputStreamReader(
new ByteArrayInputStream(new byte[2]));
return reader.getEncoding();
}

There is a lot being allocated/freed there just to find the default
encodings. Would it be possible to move the code in
getDefaultJavaEncodings into loadEncodings and store the result as a
static?

For my test (which may be atypical) 1% of my code's execution time was
spent inside getDefaultJavaEncoding().

I am working with JayBird 1.0 and can supply a patch if you are
interested.

I can also give some additional performance data from the profiler if
you are interested. For example - the biggest hits I am taking from
JayBird are in GDS_Impl.parseTruncSqlInfo and GDS_Impl.isc_vax_integer
but that would be expected.

-Ken




To unsubscribe from this group, send an email to:
Firebird-Java-unsubscribe@yahoogroups.com



Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/