Re: [PATCH] Custom code int(32|64) => text conversions out of performance reasons - Mailing list pgsql-hackers

From Robert Haas
Subject Re: [PATCH] Custom code int(32|64) => text conversions out of performance reasons
Date
Msg-id AANLkTik4QXhrgkv_K+5+hDakRcasWF3eGOmmagxm8FTw@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Custom code int(32|64) => text conversions out of performance reasons  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: [PATCH] Custom code int(32|64) => text conversions out of performance reasons
List pgsql-hackers
On Fri, Nov 19, 2010 at 10:18 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> Sure thing.  Thanks for taking time to do this - very nice speedup.
> This part now committed, too.

It occurs to me belatedly that there might be a better way to do this.Instead of flipping value from negative to
positive,with a special 
case for the smallest possible integer, we could do it the other
round.  And actually, I think we can rid of neg, too.

if (value < 0)   *a++ = '-';
else   value = -value;
start = a;

Then we could just adjust the calculation of the actual digit.

*a++ = '0' + (-remainder);

Good idea?  Bad idea?  Seems cleaner to me, assuming it'll actually work...

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Fwd: patch: format function - fixed oid
Next
From: Robert Haas
Date:
Subject: Re: Fwd: patch: format function - fixed oid