Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g7g8g-0007nS-Ae for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Oct 2018 12:20:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g7g8e-0001UI-9y for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Oct 2018 12:20:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g7g8e-0001Te-2y for pgsql-hackers@lists.postgresql.org; Wed, 03 Oct 2018 12:20:24 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g7g8b-000595-NT for pgsql-hackers@lists.postgresql.org; Wed, 03 Oct 2018 12:20:23 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w93CKEUd025584; Wed, 3 Oct 2018 08:20:14 -0400 From: Tom Lane To: Andres Freund cc: pgsql-hackers@lists.postgresql.org, Thomas Munro , Andrew Gierth , Alexander Kuzmenkov Subject: Re: Performance improvements for src/port/snprintf.c In-reply-to: <20181003060936.zul7mfkcu5w7rotg@alap3.anarazel.de> References: <20180926221814.el5nwmkez6zfmzbz@alap3.anarazel.de> <14302.1538005507@sss.pgh.pa.us> <20180926235821.zmpxqv66ob7v2ffi@alap3.anarazel.de> <15882.1538007944@sss.pgh.pa.us> <20180927004022.lfhffbj3roxzf5ca@alap3.anarazel.de> <20180927005705.shbl3n5hq3t65n2j@alap3.anarazel.de> <87r2hffwda.fsf@news-spur.riddles.org.uk> <6FEC34CD-B8C0-44E2-8D1F-2320568BDC78@anarazel.de> <30551.1538517271@sss.pgh.pa.us> <20181003060936.zul7mfkcu5w7rotg@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Tue, 02 Oct 2018 23:09:36 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <25582.1538569214.1@sss.pgh.pa.us> Date: Wed, 03 Oct 2018 08:20:14 -0400 Message-ID: <25583.1538569214@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > On 2018-10-02 17:54:31 -0400, Tom Lane wrote: >> Here's a version of this patch rebased over commit 625b38ea0. > Cool. Let's get that in... Cool, I'll push it shortly. >> While there might be value in implementing our own float printing code, >> I have a pretty hard time getting excited about the cost/benefit ratio >> of that. I think that what we probably really ought to do here is hack >> float4out/float8out to bypass the extra overhead, as in the 0002 patch >> below. > I'm thinking we should do a bit more than just that hack. I'm thinking > of something (barely tested) like Meh. The trouble with that is that it relies on the platform's snprintf, not sprintf, and that brings us right back into a world of portability hurt. I don't feel that the move to C99 gets us out of worrying about noncompliant snprintfs --- we're only requiring a C99 *compiler*, not libc. See buildfarm member gharial for a counterexample. I'm happy to look into whether using strfromd when available buys us anything over using sprintf. I'm not entirely convinced that it will, because of the need to ASCII-ize and de-ASCII-ize the precision, but it's worth checking. > FWIW, I think there's still a significant argument to be made that we > should work on our floating point IO performance. Both on the input and > output side. It's a significant practical problem. But both a fix like > you describe, and my proposal, should bring us to at least the previous > level of performance for the hot paths. So that'd then just be an > independent consideration. Well, an independent project anyway. I concur that it would have value; but whether it's worth the effort, and the possible behavioral changes, is not very clear to me. regards, tom lane