From: | "Fear, Jake" <jfear(at)soe(dot)sony(dot)com> |
---|---|
To: | <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | 8.2 driver getBoolean(...) performance question |
Date: | 2007-04-14 00:09:02 |
Message-ID: | 7EA6A25EC6360A488E0EBB5F3F21A0DC15D1CBC6@mail-sd4.ad.soe.sony.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
I've been profiling an application using both the 8.1 and 8.2 drivers
(congratulations on the improvements!) and I have a question regarding
the order in which the values in the method AbstractJdbc2ResultSet are
interpreted:
Here is the block of code in question:
if (s.equalsIgnoreCase("t") || s.equalsIgnoreCase("true") ||
s.equals("1"))
return true;
if (s.equalsIgnoreCase("f") || s.equalsIgnoreCase("false")
|| s.equals("0"))
return false;
It checks t then true then 1, but the code in the method
AbstractJdbc2Statement.setBoolean:
public void setBoolean(int parameterIndex, boolean x) throws
SQLException
{
checkClosed();
bindString(parameterIndex, x ? "1" : "0", Oid.BOOL);
}
Seems to indicate the 0 or 1, if the drivers are being used as expected,
will be the preferred values, and would make sense on the left hand site
of the short-circuiting || operation in the result set class.
The getBoolean method isn't nearly as high in the profiler as it was on
the 8.1 drivers, but it is still showing up consuming more CPU than I
would expect.
So my question is this: Is there anything I'm missing that actually
makes the t/f values the preferred test? Am I missing something on the
statement side that makes this more efficient? In my particular case
(using Hibernate and explicitly using boolean data types) putting the
0/1 test first is more efficient.
Thanks,
Jake Fear
Software Engineering Supervisor
Sony Online Entertainment
858-790-3526
From | Date | Subject | |
---|---|---|---|
Next Message | Kris Jurka | 2007-04-14 04:16:52 | Re: 8.2 driver getBoolean(...) performance question |
Previous Message | Paul Tomblin | 2007-04-13 20:28:56 | Re: What changed? |