pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
To: Kris Jurka <books@ejurka.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Fast BigDecimal
Date: Sun, 19 Apr 2009 11:16:14 +0300
Message-ID: <49EADDCE.90500@enterprisedb.com> (raw)
In-Reply-To: <Pine.BSO.4.64.0904190118370.28015@leary.csoft.net>
References: <49E72C90.9010903@enterprisedb.com>
	<Pine.BSO.4.64.0904181954340.31632@leary.csoft.net>
	<Pine.BSO.4.64.0904190118370.28015@leary.csoft.net>

Kris Jurka wrote:
> 
> 
> On Sat, 18 Apr 2009, Kris Jurka wrote:
> 
>> On Thu, 16 Apr 2009, Heikki Linnakangas wrote:
>>
>>> Here's another patch I put together while trying to improve 
>>> performance for the customer that bumped into the repeated Describe 
>>> thing yesterday. It speeds up ResultSet.getBigDecimal() with the same 
>>> fastpath implementation we have for getInt and getLong.
>>
>> To maintain the same behavior as the current code, you need to handle 
>> the period more carefully.  You must ensure that there is only one and 
>> that there's at least one other number.  Consider the case of SELECT 
>> '.' OR SELECT '1.......'.
>>
> 
> For some reason I thought this would be tricky.  We just need to track 
> the total number for periods seen and error out if > 1 or equal to the 
> total number of characters.  I've done that and committed it.

Thanks. One more thing: this accepts "-.", which the normal version 
doesn't. Patch attached.

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

Attachments:

a.patch (text/x-diff, 887B) download Index: org/postgresql/jdbc2/AbstractJdbc2ResultSet.java =================================================================== RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java,v retrieving revision 1.106 diff -c -r1.106 AbstractJdbc2ResultSet.java *** org/postgresql/jdbc2/AbstractJdbc2ResultSet.java 19 Apr 2009 05:18:31 -0000 1.106 --- org/postgresql/jdbc2/AbstractJdbc2ResultSet.java 19 Apr 2009 08:15:03 -0000 *************** *** 2191,2197 **** val += b - '0'; } ! if (periodsSeen > 1 || periodsSeen == bytes.length) throw FAST_NUMBER_FAILED; if (neg) { --- 2191,2198 ---- val += b - '0'; } ! if (periodsSeen > 1 || ! periodsSeen == (neg ? bytes.length - 1 : bytes.length)) throw FAST_NUMBER_FAILED; if (neg) {

view thread (5+ messages)  latest in thread

Message-ID: <49EADDCE.90500@enterprisedb.com>
Permalink:  ../49EADDCE.90500@enterprisedb.com/
Also on:    postgresql.org/message-id/49EADDCE.90500@enterprisedb.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: heikki.linnakangas@enterprisedb.com, books@ejurka.com
  Subject: Re: Fast BigDecimal
  In-Reply-To: <49EADDCE.90500@enterprisedb.com>
  References: <49E72C90.9010903@enterprisedb.com> <Pine.BSO.4.64.0904181954340.31632@leary.csoft.net> <Pine.BSO.4.64.0904190118370.28015@leary.csoft.net> <49EADDCE.90500@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox