From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk1-xa34.google.com (mail-vk1-xa34.google.com [IPv6:2607:f8b0:4864:20::a34]) by sourceware.org (Postfix) with ESMTPS id 71BD83858CD1 for ; Fri, 14 Jul 2023 19:56:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 71BD83858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=cs.washington.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cs.washington.edu Received: by mail-vk1-xa34.google.com with SMTP id 71dfb90a1353d-47e106c3f56so839168e0c.2 for ; Fri, 14 Jul 2023 12:56:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.washington.edu; s=goo201206; t=1689364560; x=1691956560; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=eRLOZrS5vXU+sTUXVuGkb+GmGAcp/SY69gQ7BQQFNOM=; b=FA3tDO1wDjrcnClkuJ1MzsWtBz3/iaX0w/m1nsQ7hvTyFHshLzljr181UC5JyRHcFE IJRp2FHsP9WMkjsBGJ11h7V3D0zigD7T58Ybehvrx81OhbVBKN2KHvm0W2H/l+VVoS7x ZtT1YHHJ05cZznwEdPZhcCJ6PsvwvrfB/ONbE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689364560; x=1691956560; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eRLOZrS5vXU+sTUXVuGkb+GmGAcp/SY69gQ7BQQFNOM=; b=j7dvZ7snpByxRXibOQQS1s19zeWY3G1Qr0Prkx/45biFZg2ru2zhdUzha1Yyq3bwxa w8ypelJSKijj5eTqE1sfurOID9ybCKfm6v7eGxT3avPTY8LtLbzA5+RP/RlBmRmaLfuD C9w6AGRoELEftEw/+F6/3SAwztPW+9AgLmBZdsYIL53Z24+j5TRe+ywTbGanYqZndWaz tIWQ4ci8bzYL4NnSGhdvGkQRHNBUm6e6k/jt3TbHkgjloCYpo6hElkQVxreDQO9w9sek LbwV493oaEDzv+vQRBgvD7dvCiLpzkkrYTS2HWOZzP/SamLKP53NuKK+hqhjtw99SKeO maog== X-Gm-Message-State: ABy/qLZm4Zf0wc6yzV6SNaEXuaFzqOT1YwLsSQOVFsnKZQp6aIsYg5pO ZYNIlG/6J1kquq18neObcTwzuFhx26Klvl4Xxy+N1A== X-Google-Smtp-Source: APBJJlHizd6vVEhAFQ7W1FKdnWfutOBLghYpBIlgHSNrX+LuIiXKHm/ayForHaIrmz14AggaVRKbO/mCH2xdc94lN9Y= X-Received: by 2002:a1f:c18c:0:b0:471:5110:49e8 with SMTP id r134-20020a1fc18c000000b00471511049e8mr3831654vkf.4.1689364560643; Fri, 14 Jul 2023 12:56:00 -0700 (PDT) MIME-Version: 1.0 References: <20230710052310.48116-1-kmatsui@gcc.gnu.org> <20230710053828.49793-1-kmatsui@gcc.gnu.org> In-Reply-To: From: Ken Matsui Date: Fri, 14 Jul 2023 12:55:44 -0700 Message-ID: Subject: Re: [PATCH v2 1/2] c++, libstdc++: implement __is_pointer built-in trait To: Jonathan Wakely Cc: Ken Matsui , gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, Jul 14, 2023 at 3:49=E2=80=AFAM Jonathan Wakely wrote: > > On Fri, 14 Jul 2023 at 11:48, Jonathan Wakely wrote: > > > > On Thu, 13 Jul 2023 at 21:04, Ken Matsui wr= ote: > > > > > > On Thu, Jul 13, 2023 at 2:22=E2=80=AFAM Jonathan Wakely wrote: > > > > > > > > On Wed, 12 Jul 2023 at 21:42, Ken Matsui wrote: > > > > > > > > > > On Wed, Jul 12, 2023 at 3:01=E2=80=AFAM Jonathan Wakely wrote: > > > > > > > > > > > > On Mon, 10 Jul 2023 at 06:51, Ken Matsui via Libstdc++ > > > > > > wrote: > > > > > > > > > > > > > > Hi, > > > > > > > > > > > > > > Here is the benchmark result for is_pointer: > > > > > > > > > > > > > > https://github.com/ken-matsui/gcc-benches/blob/main/is_pointe= r.md#sun-jul--9-103948-pm-pdt-2023 > > > > > > > > > > > > > > Time: -62.1344% > > > > > > > Peak Memory Usage: -52.4281% > > > > > > > Total Memory Usage: -53.5889% > > > > > > > > > > > > Wow! > > > > > > > > > > > > Although maybe we could have improved our std::is_pointer_v any= way, like so: > > > > > > > > > > > > template > > > > > > inline constexpr bool is_pointer_v =3D false; > > > > > > template > > > > > > inline constexpr bool is_pointer_v<_Tp*> =3D true; > > > > > > template > > > > > > inline constexpr bool is_pointer_v<_Tp* const> =3D true; > > > > > > template > > > > > > inline constexpr bool is_pointer_v<_Tp* volatile> =3D true; > > > > > > template > > > > > > inline constexpr bool is_pointer_v<_Tp* const volatile> =3D t= rue; > > > > > > > > > > > > I'm not sure why I didn't already do that. > > > > > > > > > > > > Could you please benchmark that? And if it is better than the c= urrent > > > > > > impl using is_pointer<_Tp>::value then we should do this in the > > > > > > library: > > > > > > > > > > > > #if __has_builtin(__is_pointer) > > > > > > template > > > > > > inline constexpr bool is_pointer_v =3D __is_pointer(_Tp); > > > > > > #else > > > > > > template > > > > > > inline constexpr bool is_pointer_v =3D false; > > > > > > template > > > > > > inline constexpr bool is_pointer_v<_Tp*> =3D true; > > > > > > template > > > > > > inline constexpr bool is_pointer_v<_Tp* const> =3D true; > > > > > > template > > > > > > inline constexpr bool is_pointer_v<_Tp* volatile> =3D true; > > > > > > template > > > > > > inline constexpr bool is_pointer_v<_Tp* const volatile> =3D t= rue; > > > > > > #endif > > > > > > > > > > Hi Fran=C3=A7ois and Jonathan, > > > > > > > > > > Thank you for your reviews! I will rename the four underscores to= the > > > > > appropriate name and take a benchmark once I get home. > > > > > > > > > > If I apply your change on is_pointer_v, is it better to add the > > > > > `Co-authored-by:` line in the commit? > > > > > > > > Yes, that would be the correct thing to do (although in this case t= he > > > > change is small enough that I don't really care about getting credi= t > > > > for it :-) > > > > > > > Thank you! I will include it in my commit :) I see that you included > > > the DCO sign-off in the MAINTAINERS file. However, if a reviewer > > > doesn't, should I include the `Signed-off-by:` line for the reviewer > > > as well? > > > > No, reviewers should not sign-off, that's for the code author. And > > authors should add that themselves (or clearly state that they agree > > to the DCO terms). You should not sign-off on someone else's behalf. > > You can add Reviewed-by: if you want to record that information. > I see. Thank you!