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 1g8dkZ-0001eE-Te for pgsql-hackers@arkaria.postgresql.org; Sat, 06 Oct 2018 03:59:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g8dkX-0005Gy-Bw for pgsql-hackers@arkaria.postgresql.org; Sat, 06 Oct 2018 03:59:29 +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 1g8dkX-0005Gr-0F for pgsql-hackers@lists.postgresql.org; Sat, 06 Oct 2018 03:59:29 +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 1g8dkP-0007hD-Lz for pgsql-hackers@lists.postgresql.org; Sat, 06 Oct 2018 03:59:27 +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 w963xFeV015406; Fri, 5 Oct 2018 23:59:15 -0400 From: Tom Lane To: Andrew Gierth cc: Andres Freund , pgsql-hackers@lists.postgresql.org, Thomas Munro , Alexander Kuzmenkov Subject: Re: Performance improvements for src/port/snprintf.c In-reply-to: <87o9c7ahjh.fsf@news-spur.riddles.org.uk> References: <28321.1538585692@sss.pgh.pa.us> <20181003170043.thdyezozi343dkuc@alap3.anarazel.de> <2132.1538587869@sss.pgh.pa.us> <20181003173639.tncawup2nnkp7vbv@alap3.anarazel.de> <2435.1538588403@sss.pgh.pa.us> <20181003174513.wxjxfj7eepytnlqa@alap3.anarazel.de> <3316.1538589695@sss.pgh.pa.us> <20181003183552.xaams6fau3i7oybj@alap3.anarazel.de> <6797.1538592539@sss.pgh.pa.us> <30726.1538754899@sss.pgh.pa.us> <20181005165819.h7gdzcbwhnhofq2b@alap3.anarazel.de> <87sh1jaiyq.fsf@news-spur.riddles.org.uk> <13967.1538795773@sss.pgh.pa.us> <87o9c7ahjh.fsf@news-spur.riddles.org.uk> Comments: In-reply-to Andrew Gierth message dated "Sat, 06 Oct 2018 04:36:51 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <15404.1538798355.1@sss.pgh.pa.us> Date: Fri, 05 Oct 2018 23:59:15 -0400 Message-ID: <15405.1538798355@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andrew Gierth writes: > Tom> Oh yeah? Where's the code for this? > Upstream code is at https://github.com/ulfjack/ryu > ... > I attach the patch I've used for testing, which has these changes from > upstream Ryu: Thanks. Just scanning through the code quickly, I note that it assumes IEEE float format, which is probably okay but I suppose we might want a configure switch to disable it (and revert to platform sprintf). I couldn't immediately figure out if it's got endianness assumptions; but even if it does, that'd likely only affect the initial disassembly of the IEEE format, so probably not a huge deal. I wonder which variant of the code you were testing (e.g. HAS_UINT128 or not). There's a pretty large gap between this code and PG coding conventions, both as to layout and portability rules. I wonder if we'd be better off to implement the algorithm afresh instead of whacking this particular code past the point of unrecognizability. > The regression tests for > float8 fail of course since Ryu's output format differs (it always > includes an exponent, but the code for that part can be tweaked without > touching the main algorithm). Yeah, one would hope. But I wonder whether it always produces the same low-order digits, and if not, whether people will complain. We just had somebody griping about a change in insignificant zeroes in timestamp output :-(. Still, seems worth further investigation. regards, tom lane