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 1g5Mt8-00053l-KH for pgsql-hackers@arkaria.postgresql.org; Thu, 27 Sep 2018 03:22:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g5Mt5-0001Uw-BC for pgsql-hackers@arkaria.postgresql.org; Thu, 27 Sep 2018 03:22:47 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g5Mt5-0001Uo-0Z for pgsql-hackers@lists.postgresql.org; Thu, 27 Sep 2018 03:22:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g5Msy-00036q-62 for pgsql-hackers@lists.postgresql.org; Thu, 27 Sep 2018 03:22:45 +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 w8R3LZMo004914; Wed, 26 Sep 2018 23:21:35 -0400 From: Tom Lane To: Andres Freund cc: Alexander Kuzmenkov , pgsql-hackers@lists.postgresql.org Subject: Re: Performance improvements for src/port/snprintf.c In-reply-to: <20180927020520.ublgc46h2sj73k47@alap3.anarazel.de> References: <15785.1536776055@sss.pgh.pa.us> <20180926220419.lorxpb564gakdjkz@alap3.anarazel.de> <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> <20180927011814.kpncoksuqq3gy44s@alap3.anarazel.de> <17058.1538012681@sss.pgh.pa.us> <20180927020520.ublgc46h2sj73k47@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Wed, 26 Sep 2018 19:05:20 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4912.1538018495.1@sss.pgh.pa.us> Date: Wed, 26 Sep 2018 23:21:35 -0400 Message-ID: <4913.1538018495@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > On 2018-09-26 21:44:41 -0400, Tom Lane wrote: >> BTW, were you thinking of plugging in strfromd() inside snprintf.c, >> or just invoking it directly from float[48]out? The latter would >> presumably be cheaper, and it'd solve the most pressing performance >> problem, if not every problem. > I wasn't actually seriously suggesting we should use strfromd, but I > guess one way to deal with this would be to add a wrapper routine that > could directly be called from float[48]out *and* from fmtfloat(). Yeah, something along that line occurred to me a bit later. > Wonder > if it'd be worthwhile to *not* pass that wrapper a format string, but > instead pass the sprecision as an explicit argument. Right, getting rid of the round trip to text for the precision seems like a win. I'm surprised that strfromd is defined the way it is and not with something like (double val, char fmtcode, int precision, ...) regards, tom lane