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 5395D3858C60 for ; Thu, 13 Jul 2023 20:04:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5395D3858C60 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-4814505ddbbso467995e0c.0 for ; Thu, 13 Jul 2023 13:04:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.washington.edu; s=goo201206; t=1689278672; x=1691870672; 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=poFwtynWNWcmZeo6QJPDpxes7T+86mwPLpTZf/LRQAA=; b=JaPqBAjWhZDnYWoFfGvvFuGgkp8YuPrMRiX8j8gk/izasVpcc7dIlTfaJcSK5O+VAk ZDojbQfMZMZitxT8GwtZuB0EiTJ8q37bQK1N9ZO31+qtmeoU9iF1FjlJFL0ienYnXuVd sqzVrt06a3A8mXfnxFUwpm0Zwr/vZYzJpINnY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689278672; x=1691870672; 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=poFwtynWNWcmZeo6QJPDpxes7T+86mwPLpTZf/LRQAA=; b=OnWwKrmpX8pmaRaMlHYbiemGal+r77AWf4uRgAkRqteAoKnAvyYk6L9NaIyFHHscBv SIa/Rh97DDg0mgcJ3lC45T4BsXt2uCsr3Xs7A2av0gqXc5TyBBiR3tLNdE9Pp5qkqktF 6V9A5Mhj9R8wR1xMzYx/oRgkMoZyDMoKqdch/MTT23R4lTIPhN+BAluTZADeTpQ3vN4C DUz98Rq7FsLufXn440cVN/RW0y+YQ68RmvZnsErRfcIOmyvf11y/Vmf54D9mZw1dcIMr 6l3nCap1fcDt8sSuwmBXRrUnf72CgLyWzSIbWH7w8uB1kDx3T24gFteC3lyXeetlDJHA j/VA== X-Gm-Message-State: ABy/qLYCicUkj3ba2DVSfn5s+nu/7U+XTCh/Nky11VEPo7DFgnuRPNJL pi1CGR2yBvQJMB0FA385D+aDcklbSQ/qVNNzLY+qaA== X-Google-Smtp-Source: APBJJlHJ36uwNYt8L0/TMj7RxqAZaL6BkWu1MePfejZ9JEmGhZSqV82fNTVCuVOAvEc4iVdI83H2dGH57n3H8mUDT0Y= X-Received: by 2002:a1f:418f:0:b0:481:2ff5:c9b2 with SMTP id o137-20020a1f418f000000b004812ff5c9b2mr1901729vka.5.1689278672527; Thu, 13 Jul 2023 13:04:32 -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: Thu, 13 Jul 2023 13:04:16 -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.2 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 Thu, Jul 13, 2023 at 2:22=E2=80=AFAM Jonathan Wakely wrote: > > On Wed, 12 Jul 2023 at 21:42, Ken Matsui wrot= e: > > > > 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_pointer.md#s= un-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 anyway, l= ike 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 true; > > > > > > I'm not sure why I didn't already do that. > > > > > > Could you please benchmark that? And if it is better than the current > > > 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 true; > > > #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 the > change is small enough that I don't really care about getting credit > 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?