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.92) (envelope-from ) id 1j9cbW-0001h2-97 for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Mar 2020 22:35:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j9cbV-0002Tz-3B for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Mar 2020 22:35:01 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1j9cbU-0002Rl-QL for pgsql-hackers@lists.postgresql.org; Wed, 04 Mar 2020 22:35:00 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j9cbS-0001FU-4d for pgsql-hackers@lists.postgresql.org; Wed, 04 Mar 2020 22:35:00 +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 024MYrCS008262; Wed, 4 Mar 2020 17:34:53 -0500 From: Tom Lane To: Alvaro Herrera cc: Pg Hackers Subject: Re: useless RangeIOData->typiofunc In-reply-to: <20200304215711.GA8732@alvherre.pgsql> References: <20200304215711.GA8732@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Wed, 04 Mar 2020 18:57:11 -0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <8260.1583361293.1@sss.pgh.pa.us> Date: Wed, 04 Mar 2020 17:34:53 -0500 Message-ID: <8261.1583361293@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera writes: > I noticed while going over the multirange types patch that it adds a > pointless typiofunc cached OID to a struct used for I/O functions' > fn_extra. It seems to go completely unused, so I checked range types > (which this was cribbed from) and indeed, it is completely unused there > either. My guess is that it was in turn cribbed from array's > ArrayMetaState, which is considerably more sophisticated; I suspect > nobody noticed that caching it was pointless. > Here's a patch to remove it from rangetypes.c. It doesn't really waste > much memory anyway, but removing it lessens the cognitive load by one or > two bits. Hm, I'm not sure that really lessens the cognitive load any, but if you do commit this please fix the dangling reference you left in the nearby comment: { TypeCacheEntry *typcache; /* range type's typcache entry */ - Oid typiofunc; /* element type's I/O function */ Oid typioparam; /* element type's I/O parameter */ FmgrInfo proc; /* lookup result for typiofunc */ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ } RangeIOData; regards, tom lane