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: pgsql-hackers@lists.postgresql.org,
Thomas Munro <thomas.munro@enterprisedb.com>,
Andrew Gierth <andrew@tao11.riddles.org.uk>,
Alexander Kuzmenkov <a.kuzmenkov@postgrespro.ru>
Date: 2018-10-05T15:54:59Z
Lists: pgsql-hackers
Andres Freund <andres@anarazel.de> writes: > [ let's use strfromd ] So I'm having second thoughts about this, based on the fact that strfromd() in't strictly a glibc-ism but is defined in an ISO/IEC standard. That means that we can expect to see it start showing up on other platforms (though a quick search did not find any evidence that it has yet). And that means that we'd better consider quality-of-implementation issues. We know that glibc's version is fractionally faster than using sprintf with "%.*g", but what are the odds that that will be true universally? I don't have a warm feeling about it, given that strfromd's API isn't a very good impedance match to what we really need. I really think that what we ought to do is apply the float[48]out hack I showed in <30551.1538517271@sss.pgh.pa.us> and call it good, at least till such time as somebody wants to propose a full-on reimplementation of float output. I don't want to buy back into having platform dependencies in this area after having just expended a lot of sweat to get rid of them. 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