pgsql: Improve speed of timestamp/time/date output functions.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Improve speed of timestamp/time/date output functions.
Date: 2016-02-07 04:11:40
Message-ID: E1aSGhI-0004cN-Hn@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2016-02-07 15:23:15 pgsql: Introduce group locking to prevent parallel processes from deadl
Previous Message Tom Lane 2016-02-06 20:13:41 pgsql: Fix comment block trashed by pgindent.