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 5657C384D1A0 for ; Wed, 7 Sep 2022 08:19:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5657C384D1A0 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=1662538792; 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=yqSVnozndzeQSeBxOdDX6mpLb43AQ2fS9QFusWMENTQ=; b=CkQfAcMlG5KFZX0lQ7kf+pTPLffSnRbeKlh4CCMGmFjIwTehOaaBFCC5lZl3Wtdt2lwJcZ yB8qPnGZ1igHqKkbtmvVyBUQVR9B7BuPwWR3IOfMcqlzXx9iv2QFTSB9l2/vTqjaMFI941 JnFM6hBmfY4l+d/MNyPuja/VkHaIuHM= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-526-PhmsD8p1NGqkZRQvRO063A-1; Wed, 07 Sep 2022 04:19:50 -0400 X-MC-Unique: PhmsD8p1NGqkZRQvRO063A-1 Received: by mail-qt1-f200.google.com with SMTP id fc18-20020a05622a489200b00344b09d2578so11193018qtb.13 for ; Wed, 07 Sep 2022 01:19:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=yqSVnozndzeQSeBxOdDX6mpLb43AQ2fS9QFusWMENTQ=; b=st8aMap6hrLqWjBsc6ZTU0zqO5BeF/Xn2q0oUSBGxV+kjDQqr5iX5ogmBlrLjJloAR Bf3CNr508JGjGHKGsE1hxIGT2if99dkgAT537M5br8/HgRmKixn7LHSvXI60Qym7Pk7y 3FHnB7WwixhwzJthbVn3k7CvWaK0ToB7A4Dr6TEZhGqFs+XdRzAYEycY4yL9CdZUfIXg stfsF+lFAP+Lm/ot/KUHRW/TQmIeFoXPWKMHMw00A+n50CfJQA/ot7b8WQFeWnHKKC0c QHOxx3qNdynpSBnrntFaJo3hzfg27Udeh/iP1oTGagP3a9vI32GsKJhhTiW+KR5v0b44 yukw== X-Gm-Message-State: ACgBeo2mFsHpnoAARQh8F45Mf9fR/Sk4OEzl/nh4ra49gvDkDVt0dIx8 y2E6Nncw+9Yv40nezA8RsczUG6loXSRVGkLIUe162E5p4a5HxrHlPxWf4xZBqVhKc79lC8H7Esu nQ5bMr0KzLu+BLQcYxUjHsPfHcA+3A6c= X-Received: by 2002:a05:620a:884:b0:6bc:2056:1005 with SMTP id b4-20020a05620a088400b006bc20561005mr1761355qka.293.1662538790245; Wed, 07 Sep 2022 01:19:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Q6sC+rNQtoeiXjc3NoBQTmYep2IcovlfrxW3XRx+Iw6G6WXvjQH0VJK7wvbbuZs/Y/9lshkkhCaL9RcmjsTM= X-Received: by 2002:a05:620a:884:b0:6bc:2056:1005 with SMTP id b4-20020a05620a088400b006bc20561005mr1761348qka.293.1662538790059; Wed, 07 Sep 2022 01:19:50 -0700 (PDT) MIME-Version: 1.0 References: <20220907004542.288365-1-ppalka@redhat.com> In-Reply-To: <20220907004542.288365-1-ppalka@redhat.com> From: Jonathan Wakely Date: Wed, 7 Sep 2022 09:19:39 +0100 Message-ID: Subject: Re: [PATCH 1/2] libstdc++: Optimize is_void and is_null_pointer To: Patrick Palka Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_DNSWL_LOW,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: On Wed, 7 Sept 2022 at 01:46, Patrick Palka via Libstdc++ wrote: > > Instead of defining these in terms of a helper class template > and the relatively expensive __remove_cv_t, just declare four > explicit specializations of the main template, one for each choice > of cv-quals. > > Tested on x86_64-pc-linux-gnu, does this look OK for trunk? Yes, and we should do the same for is_void_v and is_null_pointer_v. Even though the class templates they instantiate will be cheaper now, they can still avoid any class template instantiation. > The is_void change alone reduces memory usage for join.cc by > almost 1%. Also in my queue of trait refactoring, but I haven't tested if these are worth doing yet: template struct is_object : is_const::type { }; template<> struct is_object : false_type { }; template<> struct is_object : false_type { }; // and so on for volatile and const volatile And we could define is_object_v as simply is_const_v && is_void_v. Improving is_object should benefit and also the is_scalar change proposed at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96710#c2