Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eOS3e-0006CL-Fz for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Dec 2017 17:40:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eOS3d-0000Y0-OU for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Dec 2017 17:40:01 +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.84_2) (envelope-from ) id 1eOS3d-0000Xg-Ei for pgsql-hackers@lists.postgresql.org; Mon, 11 Dec 2017 17:40:01 +0000 Received: from ping.uio.no ([2001:700:100:570::196]) by makus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eOS3a-0001lK-NI for pgsql-hackers@lists.postgresql.org; Mon, 11 Dec 2017 17:40:00 +0000 Received: from [2001:700:100:570::211] (helo=dalvik.ping.uio.no ident=Debian-exim) by ping.uio.no with esmtp (Exim 4.72 #1 (Debian)) id 1eOS3R-0002Bu-9B; Mon, 11 Dec 2017 18:39:51 +0100 Received: from ilmari by dalvik.ping.uio.no with local (Exim 4.84_2) (envelope-from ) id 1eOS3Q-00030Y-MG; Mon, 11 Dec 2017 18:39:48 +0100 From: ilmari@ilmari.org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=) To: Robert Haas Cc: Tom Lane , Tomas Vondra , pgsql-hackers@lists.postgresql.org Subject: Re: Rethinking MemoryContext creation References: <2264.1512870796@sss.pgh.pa.us> <9726.1513009650@sss.pgh.pa.us> <12544.1513011559@sss.pgh.pa.us> Mail-Copies-To: nobody Date: Mon, 11 Dec 2017 17:39:48 +0000 In-Reply-To: (Robert Haas's message of "Mon, 11 Dec 2017 12:22:09 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Exiscan-Spam-Score: -3.7 (---) X-Exiscan-Spam-Report: SpamAssassin 3.3.1 (2010-03-16) on pike.ping.uio.no Score Rule * -5.0 PING_UIO_MAIL_IS_INTERNAL Message has never been outside * 129.240.0.0/16 or 193.157.115.0/24 * 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Robert Haas writes: > On Mon, Dec 11, 2017 at 11:59 AM, Tom Lane wrote: >> Tomas Vondra writes: >>> On 12/11/2017 05:27 PM, Tom Lane wrote: >>>> However, unless we want to run around and touch all the ~ 150 calls >>>> with constant arguments, we'd have to set things up so that the default >>>> behavior for AllocSetContextCreate is to not copy. This risks breaking >>>> callers in extensions. Not entirely sure if it's worth that --- any >>>> thoughts? >> >>> I don't think silently breaking extensions is particularly attractive >>> option, so I guess we'll have to run around and tweak the ~150 calls. >> >> Meh. I suppose that of the ~150 call sites, there are probably only >> a dozen or two where it would actually make a performance difference, >> so maybe this needn't be quite as invasive as I first thought. > > I think changing only a subset of the call sites is unappealing > because, even though it may not make a measurable performance > difference in other cases, it may get cargo-culted into some place > where it does make a difference. Would it be acceptable to only get this optimisation on compilers that support __builtin_constant_p or similar? If so, the wrapper macro could use that to automatically pass the no-copy flag when called with a literal string. - ilmari -- "I use RMS as a guide in the same way that a boat captain would use a lighthouse. It's good to know where it is, but you generally don't want to find yourself in the same spot." - Tollef Fog Heen