Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1drNXm-00033q-AF for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Sep 2017 12:10:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1drNXl-0005nZ-TC for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Sep 2017 12:10:25 +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.84_2) (envelope-from ) id 1drNXl-0005n9-8F for pgsql-hackers@postgresql.org; Mon, 11 Sep 2017 12:10:25 +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.84_2) (envelope-from ) id 1drNXe-0000Mc-7Z for pgsql-hackers@postgresql.org; Mon, 11 Sep 2017 12:10:24 +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 v8BCAE1T011631; Mon, 11 Sep 2017 08:10:14 -0400 From: Tom Lane To: Andres Freund cc: pgsql-hackers@postgresql.org Subject: Re: Constifying numeric.c's local vars In-reply-to: <20170910232154.asgml44ji2b7lv3d@alap3.anarazel.de> References: <20170910232154.asgml44ji2b7lv3d@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Sun, 10 Sep 2017 16:21:54 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <11629.1505131814.1@sss.pgh.pa.us> Date: Mon, 11 Sep 2017 08:10:14 -0400 Message-ID: <11630.1505131814@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Andres Freund writes: > One large user of unnecessary non-constant static variables is > numeric.c. More out of curiosity - numeric is slow enough in itself to > make inlining not a huge win - I converted it to use consts. LGTM. > It's a bit ugly that some consts have to be casted away in the constant > definitions, but aside from just inlining the values, I don't quite see > a better solution? No, I don't either. I'm not sure that writing the constant inline would produce the desired results - the compiler might well decide that it had to be in read-write storage. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers