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 1s9jdj-004fUm-0s for pgsql-general@arkaria.postgresql.org; Wed, 22 May 2024 10:56:12 +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 1s9jdi-00FnGX-Un for pgsql-general@arkaria.postgresql.org; Wed, 22 May 2024 10:56:10 +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 1s9jdi-00FnGO-HT for pgsql-general@lists.postgresql.org; Wed, 22 May 2024 10:56:10 +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 1s9jdc-000Bem-RH for pgsql-general@postgresql.org; Wed, 22 May 2024 10:56:09 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id 12B85301C78D for ; Wed, 22 May 2024 12:55:59 +0200 (CEST) Received: from s979.loopia.se (unknown [172.22.191.6]) by s807.loopia.se (Postfix) with ESMTP id 03AA22E2A161; Wed, 22 May 2024 12:55:59 +0200 (CEST) Received: from s473.loopia.se (unknown [172.22.191.5]) by s979.loopia.se (Postfix) with ESMTP id 022B210BC4BB; Wed, 22 May 2024 12:55:59 +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: s473.loopia.se (amavisd-new); dkim=pass (2048-bit key) header.d=yesql.se Received: from s979.loopia.se ([172.22.191.6]) by s473.loopia.se (s473.loopia.se [172.22.190.13]) (amavisd-new, port 10024) with LMTP id bVFOoJHNSc-i; Wed, 22 May 2024 12:55:58 +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 s979.loopia.se (Postfix) with ESMTPSA id 7241410BC499; Wed, 22 May 2024 12:55:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yesql.se; s=loopiadkim1707475645; t=1716375358; bh=LEwDew+t/eo3qc0P7vP10oVbTuEVF39WXXsWlbO5/Ok=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=U8X/kx2HM+0A8eatbL8CLS6aybgW8jpWLg6tx6XkAyL/cKKfcIerMewthfDpASDuP Pt9A8Q/ERFed+WNYVNHmwzaj4TB9n0+vxeNXAcfUssjGS+bBSvua2eHBzkjs2DkbqP A5dpLxH5bODcRHYmjXqHDIeRWT3XK7spp1Y3g7ey4S+wfUbv9quhpkaz2yvF0YesvU juRhHUxHbuKClLIOeH9+kNwcTYA0CtPLi8cmoLeDwMt3OrwJXh1s0eiRTTh5R9s0/a gBc/7v2hm6aS0DCN2/Jipbr93kwThVeOh1obgNFwgosoM4LQ8PzhkQZEGFVo921lAJ j+9zO/aRWDrXg== 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: Date: Wed, 22 May 2024 12:55:48 +0200 Cc: pgsql-general@postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <23848714-3662-428E-8E6D-5986D87491D6@yesql.se> References: <05C4ADF5-5E8C-49EC-8E0A-804BB946F1C7@yesql.se> To: XChy 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 12:12, XChy wrote: >=20 >> How is the memset in select_rtable_names_for_explain a dead-store? = Even memset calls could be optimized away from the EXPLAIN codepath I = have a feeling it >> would have to be many in a tight loop for it to be measurable even? > For the first question, I don't mean that the memset is the dead = store. Gotcha > I mean that the stores with value "0" after the memset are dead: > ```=20 > dpns.subplans =3D NIL; > dpns.ctes =3D NIL; > dpns.appendrels =3D NULL; > ``` > since the memset has written zeroes to the object "dpns", and these = members are known to be zero. They are known to be zero, but that's not entirely equivalent though is = it? NIL is defined as ((List *) NULL) and NULL is typically defined as = ((void *) 0), so sizeof(0) would be the size of an int and sizeof(NULL) would be = the size of a void pointer. -- Daniel Gustafsson