pgsql: Improve speed of timestamp/time/date output functions. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Improve speed of timestamp/time/date output functions.
Date
Msg-id E1aSGhI-0004cN-Hn@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Improve speed of timestamp/time/date output functions.

It seems that sprintf(), at least in glibc's version, is unreasonably slow
compared to hand-rolled code for printing integers.  Replacing most uses of
sprintf() in the datetime.c output functions with special-purpose code
turns out to give more than a 2X speedup in COPY of a table with a single
timestamp column; which is pretty impressive considering all the other
logic in that code path.

David Rowley and Andres Freund, reviewed by Peter Geoghegan and myself

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/aa2387e2fd532954e88dfd8546ab894b9305123d

Modified Files
--------------
src/backend/utils/adt/datetime.c | 389 ++++++++++++++++++++++++++-------------
src/backend/utils/adt/numutils.c | 161 ++++++++++++++++
src/include/utils/builtins.h     |   2 +
3 files changed, 424 insertions(+), 128 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix comment block trashed by pgindent.
Next
From: Robert Haas
Date:
Subject: pgsql: Introduce group locking to prevent parallel processes from deadl