Re: [PATCH] Custom code int(32|64) => text conversions out of performance reasons
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@postgresql.org
Date: 2010-11-20T12:21:06Z
Lists: 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