Subject RE: [Firebird-Java] Driver Speed Tests - Patch
Author Ken Richard
This patch adds a "findString" method to the clumplet. The findString
is implemented by caching the string representation of the content -
only after the first time that content is requested. I did notice a
performance gain in my tests. Would you review the patch and apply it
if you feel that it is acceptable? My question would be - does the data
inside the clumplet ever change after it created?



C:\dev\firebird>call cvs
-d:pserver:anonymous@...:/cvsroot/firebird/
login
(Logging in to anonymous@...)

C:\dev\firebird>call cvs -z3
-d:pserver:anonymous@...:/cvsroot/firebird diff
client-java
? client-java/.cvspass
? client-java/output
? client-java/thirdparty
Index: client-java/src/main/org/firebirdsql/gds/Clumplet.java
===================================================================
RCS file:
/cvsroot/firebird/client-java/src/main/org/firebirdsql/gds/Clumplet.java
,v
retrieving revision 1.2
diff -r1.2 Clumplet.java
41c41,43
<
---
>
> String findString(int type);
>
Index:
client-java/src/main/org/firebirdsql/jca/FBConnectionRequestInfo.java
===================================================================
RCS file:
/cvsroot/firebird/client-java/src/main/org/firebirdsql/jca/FBConnectionR
equestInfo.java,v
retrieving revision 1.2
diff -r1.2 FBConnectionRequestInfo.java
80,89c80,84
< if (c == null)
< {
< return null;
< } // end of if ()
< if (c.find(type) == null)
< {
< return null;
< } // end of if ()
< return new String(c.find(type));
< }
---
> if (c == null) {
> return null;
> }
> return c.findString(type);
> }
Index: client-java/src/main/org/firebirdsql/jgds/ClumpletImpl.java
===================================================================
RCS file:
/cvsroot/firebird/client-java/src/main/org/firebirdsql/jgds/ClumpletImpl
.java,v
retrieving revision 1.2
diff -r1.2 ClumpletImpl.java
45a46
> String cachedString = null;
85a87,99
>
> public String findString(int type) {
> if (type==this.type) {
> if (cachedString==null) {
> cachedString = new String(content);
> }
> return cachedString;
> }
> if (next==null) {
> return null;
> }
> return next.findString(type);
> }