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(-)