Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iqTzm-0008Cb-PX for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Jan 2020 03:32:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iqTzk-0000BG-PZ for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Jan 2020 03:32:56 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iqTzk-0000B9-Bj for pgsql-hackers@lists.postgresql.org; Sun, 12 Jan 2020 03:32:56 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iqTzd-0006wD-UD for pgsql-hackers@postgresql.org; Sun, 12 Jan 2020 03:32:54 +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 00C3Wjjt028765; Sat, 11 Jan 2020 22:32:45 -0500 From: Tom Lane To: David Fetter cc: Jeff Janes , pgsql-hackers Subject: Re: Why is pq_begintypsend so slow? In-reply-to: <5450.1578797036@sss.pgh.pa.us> References: <31795.1578773977@sss.pgh.pa.us> <20200112014107.GC32763@fetter.org> <5450.1578797036@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sat, 11 Jan 2020 21:43:56 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <28763.1578799965.1@sss.pgh.pa.us> Date: Sat, 11 Jan 2020 22:32:45 -0500 Message-ID: <28764.1578799965@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I wrote: > I saw at this point that the remaining top spots were > enlargeStringInfo and appendBinaryStringInfo, so I experimented > with inlining them (again, see patch below). That *did* move > the needle: down to 72691 ms, or 20% better than HEAD. Oh ... marking the test in the inline part of enlargeStringInfo() as unlikely() helps quite a bit more: 66100 ms, a further 9% gain. Might be over-optimizing for this particular case, perhaps, but I think that's a reasonable marking given that we overallocate the stringinfo buffer for most uses. (But ... I'm not finding these numbers to be super reproducible across different ASLR layouts. So take it with a grain of salt.) regards, tom lane