diff options
author | Andrew Gierth <rhodiumtoad@postgresql.org> | 2020-02-01 21:57:14 +0000 |
---|---|---|
committer | Andrew Gierth <rhodiumtoad@postgresql.org> | 2020-02-01 21:57:14 +0000 |
commit | 1fd687a035558238c0e3cab09fc22dc61a088869 (patch) | |
tree | a1bb4aeffc21f7fc0e96f7d86d0b80c5c3b0ab8c /src/backend/access/common/printsimple.c | |
parent | 7bae0ad9fcb76b28410571dc71edfdc3175c4a02 (diff) | |
download | postgresql-1fd687a035558238c0e3cab09fc22dc61a088869.tar.gz postgresql-1fd687a035558238c0e3cab09fc22dc61a088869.zip |
Optimizations for integer to decimal output.
Using a lookup table of digit pairs reduces the number of divisions
needed, and calculating the length upfront saves some work; these
ideas are taken from the code previously committed for floats.
David Fetter, reviewed by Kyotaro Horiguchi, Tels, and me.
Discussion: https://postgr.es/m/20190924052620.GP31596%40fetter.org
Diffstat (limited to 'src/backend/access/common/printsimple.c')
-rw-r--r-- | src/backend/access/common/printsimple.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/access/common/printsimple.c b/src/backend/access/common/printsimple.c index 4006ebdabd3..0f0b54bdae3 100644 --- a/src/backend/access/common/printsimple.c +++ b/src/backend/access/common/printsimple.c @@ -112,7 +112,7 @@ printsimple(TupleTableSlot *slot, DestReceiver *self) case INT8OID: { int64 num = DatumGetInt64(value); - char str[23]; /* sign, 21 digits and '\0' */ + char str[MAXINT8LEN + 1]; pg_lltoa(num, str); pq_sendcountedtext(&buf, str, strlen(str), false); |