Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s9qSK-005UG3-4H for pgsql-general@arkaria.postgresql.org; Wed, 22 May 2024 18:12:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s9qSJ-002LrW-Sp for pgsql-general@arkaria.postgresql.org; Wed, 22 May 2024 18:12:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s9qSJ-002LrN-Dy for pgsql-general@lists.postgresql.org; Wed, 22 May 2024 18:12:51 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s9qSG-000F5G-Vw for pgsql-general@postgresql.org; Wed, 22 May 2024 18:12:50 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id EA3B93016B58 for ; Wed, 22 May 2024 20:12:47 +0200 (CEST) Received: from s934.loopia.se (unknown [172.22.191.6]) by s807.loopia.se (Postfix) with ESMTP id D97212E2C4CD; Wed, 22 May 2024 20:12:47 +0200 (CEST) Received: from s474.loopia.se (unknown [172.22.191.5]) by s934.loopia.se (Postfix) with ESMTP id D72467CEA60; Wed, 22 May 2024 20:12:47 +0200 (CEST) X-Virus-Scanned: amavisd-new at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1.2 X-Spam-Level: X-Spam-Status: No, score=-1.2 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1] autolearn=disabled Authentication-Results: s474.loopia.se (amavisd-new); dkim=pass (2048-bit key) header.d=yesql.se Received: from s934.loopia.se ([172.22.191.6]) by s474.loopia.se (s474.loopia.se [172.22.190.14]) (amavisd-new, port 10024) with LMTP id F6OM4FZrUJOq; Wed, 22 May 2024 20:12:47 +0200 (CEST) X-Loopia-Auth: user X-Loopia-User: daniel@yesql.se X-Loopia-Originating-IP: 89.255.232.193 Received: from smtpclient.apple (customer-89-255-232-193.stosn.net [89.255.232.193]) (Authenticated sender: daniel@yesql.se) by s934.loopia.se (Postfix) with ESMTPSA id 3C6F17CEA61; Wed, 22 May 2024 20:12:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yesql.se; s=loopiadkim1707475645; t=1716401567; bh=t/fFeCNGTIMAfANSIjNYQFCPpPNoKFleSXpRhJswuwk=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=JyX9GNTHoNU1n9em3Ot56wxsD9C4/nDu6zkEy9X4H/cLmzxYJ7QBheW/hDWdMg+Pb +TNhj0EVtIqzeLZ/ZcnOMRk90bATu/yysJWot2WgvW2e6JrbMxBD8WZqNzmsgqUxnW HnB9/dOzkDiFW3rTNy+2GzJiPGI7uiul47spRJR1OxYWz++Hbyu3LXPi3yoEMdhslb T7xOkPKs3XnixYK2oSYNW2ftcEHa7mIYA8YJeiSivkNXdr86wFWa7KpP/WGQG/A6rs KMoZhWn/RSZ4li3uSafZFCpCW5tM5Il19qcnJpSxi7oyeAEzep8DELWZXDRC2W/8fT hVevW7aBxXnCQ== Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.500.171.1.1\)) Subject: Re: Missed compiler optimization issue in function select_rtable_names_for_explain From: Daniel Gustafsson In-Reply-To: <202405221100.fy66dsew2f52@alvherre.pgsql> Date: Wed, 22 May 2024 20:12:36 +0200 Cc: XChy , pgsql-general@postgresql.org Content-Transfer-Encoding: 7bit Message-Id: <8912D37E-1FEB-4772-9BA2-2E5F4D940684@yesql.se> References: <202405221100.fy66dsew2f52@alvherre.pgsql> To: Alvaro Herrera X-Mailer: Apple Mail (2.3774.500.171.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 22 May 2024, at 13:00, Alvaro Herrera wrote: > I think if we want to improve how this code is seen by the compiler by > modifying it, we should just remove the NULL/NIL assignments. *If* the optimization is measurable, IMHO. > It's a > pretty arbitrary (and rather small) subset of fields being initialized, > fields which very obviously have been zeroed by memset already, so I > don't see any value in the explicit assignments. My personal opinion is that there is value in immediately knowing the type of the members from the inits, in this case I know without looking up the definition that some of the members are list. I like that readability. That being said, I for sure won't fight if there is concensus to remove. -- Daniel Gustafsson