From: | Jeremy Whiting <jwhiting(at)redhat(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Performance improvement proposal. Removal of toLowerCase calls. |
Date: | 2014-01-16 15:44:30 |
Message-ID: | 52D7FE5E.3050503@redhat.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Hi,
I would like to propose an optimization to improve performance in the
jdbc driver. The performance improvement has been tested on commodity
hardware using an industry standard Java benchmark. The overall
benchmark metric reports an improvement in performance. Profiling using
sampling showed calls reduced from 1100 to 0 when the benchmark workload
is running.
The optimization will eliminate calls to the method
toLowerCase(java.util.Locale). This in the pg-jdbc
org.postgresql.jdbc2.AbstractJdbc2ResultSet.findColumnIndex(java.lang.String)
method when setting up the column index registry.
For the optimization to be enabled I suggest relying on a new system
property. Making the existing functionality the default behaviour to
ensure existing applications do not break when the driver is upgraded.
The change removes the call toLowerCase when putting items in the
registry [1]. Essentially what's being proposed is removing sanitizing
the key names. For best performance application code should pass SQL to
the driver with column names already folded to lower case. But upper
case names will still be matched in the second lookup [2] in the method.
For this optimization to work this feature introduces a requirement on
applications. To use all lower or upper case column names.
Are there other factors that might affect this optimization that need
to be taken into consideration ?
Regards,
Jeremy Whiting
Senior Software Engineer
Red Hat
[1]
https://github.com/pgjdbc/pgjdbc/blob/REL9_3_STABLE/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java?#L2742
[2]
https://github.com/pgjdbc/pgjdbc/blob/REL9_3_STABLE/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java?#L2752
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Cramer | 2014-01-16 16:12:40 | Re: Performance improvement proposal. Removal of toLowerCase calls. |
Previous Message | Pawel Veselov | 2014-01-15 20:37:11 | Re: How can this abstract method error happen? |