From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 6E7533858D1E for ; Tue, 20 Jun 2023 15:32:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6E7533858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687275149; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BYzgYfd4wDXfH36PMmumXCc/Ph51IXIwxFZz+05wrq4=; b=CnxioF6Cujg+/rS0cmYFls1ATeu6Ag4obD4Nf+qGejVYuVh1ERlKfNmkGvpwGghF4U19Fu t6PRTa/nk2dcc15QaEpOnReEZ4H/peoeVZQAg4CLaRkqyT51lxZTrj7wbG+y4ASm4IAY3t 0kNUIPyB+wdL233BF3+SetNBawtluog= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-66-rBdGEKCfMP692djj6XrCkw-1; Tue, 20 Jun 2023 11:32:16 -0400 X-MC-Unique: rBdGEKCfMP692djj6XrCkw-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-7623a4864c2so538522385a.3 for ; Tue, 20 Jun 2023 08:32:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687275130; x=1689867130; h=mime-version:references:message-id:in-reply-to:subject:cc:to:date :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jRQ5Tv+ncClM0EpgSD8Iv8Uo7o5AgG2pz9FY9rAJ+ZQ=; b=fHD2VsL0gd+9UqsIYFVk/Yh4CCOOZuPhm59IncOqX3PbfnDVr9jxZGhPXUZC49j3ZX Vp7rjHVu14MccoG/lJQ+WbXfFUEUEgY5a2HdeiqKmh/V4qKEOseWBFwd8NGwT0ZlaFBQ hdffhbGyvFAjO2aEUcCPC4FS69zgTzwTB3SHe7sspx2A+W8pawU6U8kwk4ljbqUzYPbv 2PowKgKZOAUttESlylitkpJHiyk8VpSfMEadAZHieig12754skw5lLzH/VUmUgPiOLS+ BhPUCFFcUa3v3OLn7suFLOb0Nv6eQQi9nxa+cs66SjKnOK9G1dyRNzzEA+S5wojJWSCi PO/g== X-Gm-Message-State: AC+VfDyD/iyA/3rxJdvEcOH+YppsqQy8kPXKdlWvHm/f9ScJfq/c3HBf 0AgGWj0Lr8Rq+or0fAl4P1ZD3AzibXBLYNiBYubK5Fd7riKf+ubLgMJ+3S1PktclQcljmP8e6Tz bnsfFzOOSQDZhUZ0oZg== X-Received: by 2002:a05:620a:22b4:b0:75d:4fb8:e219 with SMTP id p20-20020a05620a22b400b0075d4fb8e219mr11190233qkh.36.1687275130558; Tue, 20 Jun 2023 08:32:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ56jbwKUPlNvbIE3rwQRd3TDkihtbyw2TPX4KmnDgFrTC/R43GqbuhnAVA2tA3unG6BxbmPfw== X-Received: by 2002:a05:620a:22b4:b0:75d:4fb8:e219 with SMTP id p20-20020a05620a22b400b0075d4fb8e219mr11190217qkh.36.1687275130305; Tue, 20 Jun 2023 08:32:10 -0700 (PDT) Received: from [192.168.1.130] (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id c26-20020a05620a135a00b00762581d01dbsm1236796qkl.30.2023.06.20.08.32.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 08:32:10 -0700 (PDT) From: Patrick Palka X-Google-Original-From: Patrick Palka Date: Tue, 20 Jun 2023 11:32:09 -0400 (EDT) To: Ken Matsui cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Subject: Re: [PATCH v7 0/6] c++, libstdc++: get std::is_object to dispatch to new built-in traits In-Reply-To: Message-ID: References: <20230612224109.20749-1-kmatsui@cs.washington.edu> <20230612224909.21188-1-kmatsui@cs.washington.edu> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="8323329-622879043-1687275129=:278865" X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-622879043-1687275129=:278865 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT On Thu, 15 Jun 2023, Ken Matsui via Libstdc++ wrote: > Hi, > > For those curious about the performance improvements of this patch, I > conducted a benchmark that instantiates 256k specializations of > is_object_v based on Patrick's code. You can find the benchmark code > at this link: > > https://github.com/ken-matsui/gcc-benches/blob/main/is_object_benchmark.cc > > On my computer, using the gcc HEAD of this patch for a release build, > the patch with -DUSE_BUILTIN took 64% less time and used 44-47% less > memory compared to not using it. That's more like it :D Though the benchmark should also invoke the trait on non-object types too, e.g. Instantiator& or Instantiator(int). > > Sincerely, > Ken Matsui > > On Mon, Jun 12, 2023 at 3:49 PM Ken Matsui wrote: > > > > Hi, > > > > This patch series gets std::is_object to dispatch to built-in traits and > > implements the following built-in traits, on which std::object depends. > > > > * __is_reference > > * __is_function > > * __is_void > > > > std::is_object was depending on them with disjunction and negation. > > > > __not_<__or_, is_reference<_Tp>, is_void<_Tp>>>::type > > > > Therefore, this patch uses them directly instead of implementing an additional > > built-in trait __is_object, which makes the compiler slightly bigger and > > slower. > > > > __bool_constant > > > > This would instantiate only __bool_constant and __bool_constant, > > which can be mostly shared. That is, the purpose of built-in traits is > > considered as achieved. > > > > Changes in v7 > > > > * Removed an unnecessary new line. > > > > Ken Matsui (6): > > c++: implement __is_reference built-in trait > > libstdc++: use new built-in trait __is_reference for std::is_reference > > c++: implement __is_function built-in trait > > libstdc++: use new built-in trait __is_function for std::is_function > > c++, libstdc++: implement __is_void built-in trait > > libstdc++: make std::is_object dispatch to new built-in traits > > > > gcc/cp/constraint.cc | 9 +++ > > gcc/cp/cp-trait.def | 3 + > > gcc/cp/semantics.cc | 12 ++++ > > gcc/testsuite/g++.dg/ext/has-builtin-1.C | 9 +++ > > gcc/testsuite/g++.dg/ext/is_function.C | 58 +++++++++++++++++++ > > gcc/testsuite/g++.dg/ext/is_reference.C | 34 +++++++++++ > > gcc/testsuite/g++.dg/ext/is_void.C | 35 +++++++++++ > > gcc/testsuite/g++.dg/tm/pr46567.C | 6 +- > > libstdc++-v3/include/bits/cpp_type_traits.h | 15 ----- > > libstdc++-v3/include/debug/helper_functions.h | 5 +- > > libstdc++-v3/include/std/type_traits | 51 ++++++++++++++++ > > 11 files changed, 216 insertions(+), 21 deletions(-) > > create mode 100644 gcc/testsuite/g++.dg/ext/is_function.C > > create mode 100644 gcc/testsuite/g++.dg/ext/is_reference.C > > create mode 100644 gcc/testsuite/g++.dg/ext/is_void.C > > > > -- > > 2.41.0 > > > > --8323329-622879043-1687275129=:278865--