Re: Performance improvements for src/port/snprintf.c
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Alexander Kuzmenkov <a.kuzmenkov@postgrespro.ru>,
pgsql-hackers@lists.postgresql.org
Date: 2018-10-02T22:04:33Z
Lists: pgsql-hackers
Andres Freund <andres@anarazel.de> writes: > I've looked through the patch. Looks good to me. Some minor notes: [ didn't see this till after sending my previous ] > - How about adding our own strchrnul for the case where we don't > HAVE_STRCHRNUL? It's possible that other platforms have something > similar, and the code wouldlook more readable that way. Sure, we could just make a "static inline strchrnul()" for use when !HAVE_STRCHRNUL. No objection. > - I know it's not new, but is it actually correct to use va_arg(args, int64) > for ATYPE_LONGLONG? Well, the problem with just doing s/int64/long long/g is that the code would then fail on compilers without a "long long" type. We could ifdef our way around that, but I don't think the code would end up prettier. Given that we only ever use "ll" modifiers via INT64_FORMAT, and that that'll only be set to "ll" if int64 is indeed "long long", those code paths should be dead code in any situation where the type pun is wrong. regards, tom lane
Commits
-
Improve snprintf.c's handling of NaN, Infinity, and minus zero.
- 6eb3eb577d76 12.0 landed
-
Rationalize snprintf.c's handling of "ll" formats.
- 595a0eab7f42 12.0 landed
-
Provide fast path in snprintf.c for conversion specs that are just "%s".
- 6d842be6c118 12.0 landed
-
Make assorted performance improvements in snprintf.c.
- abd9ca377d66 12.0 landed
-
Set snprintf.c's maximum number of NL arguments to be 31.
- 625b38ea0e98 12.0 cited
-
Always use our own versions of *printf().
- 96bf88d52711 12.0 cited