diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2016-02-06 23:11:28 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2016-02-06 23:11:28 -0500 |
commit | aa2387e2fd532954e88dfd8546ab894b9305123d (patch) | |
tree | c58b1331597a50ad2cfc96b4fac5a81fde34f050 /src/include/utils/builtins.h | |
parent | b921aeb1676f128f2c41ddc40d3887964ea9eae9 (diff) |
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
Diffstat (limited to 'src/include/utils/builtins.h')
-rw-r--r-- | src/include/utils/builtins.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index c9be32e33ac..affcc01a409 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -290,6 +290,8 @@ extern int32 pg_atoi(const char *s, int size, int c); extern void pg_itoa(int16 i, char *a); extern void pg_ltoa(int32 l, char *a); extern void pg_lltoa(int64 ll, char *a); +extern char *pg_ltostr_zeropad(char *str, int32 value, int32 minwidth); +extern char *pg_ltostr(char *str, int32 value); /* * Per-opclass comparison functions for new btrees. These are |