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 079D03858C39 for ; Fri, 19 Nov 2021 10:43:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 079D03858C39 Received: from mail-yb1-f199.google.com (mail-yb1-f199.google.com [209.85.219.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-282-ECyXN3TFNl2p-2Jo8ilB7w-1; Fri, 19 Nov 2021 05:43:35 -0500 X-MC-Unique: ECyXN3TFNl2p-2Jo8ilB7w-1 Received: by mail-yb1-f199.google.com with SMTP id z65-20020a256544000000b005c21b35717dso14690752ybb.10 for ; Fri, 19 Nov 2021 02:43:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wq8eRSiuG3DRqm3PyIVCHet2WUO6BjHwv+I2C7SPcmc=; b=XB2LKN1YSo1hYdi/VE94G1Vq0qAJsa00Ic/VIE5/B7XVEIeJLKQpJ7mps9T12PNp7+ G5Y9FyKkTh3XwOloBN6DY1BQMg8wCSU2nbv21vmes90XHXs3FKATjyrIpJvMrjH6Im3Y p6JNCcKHIyNJi8/Xmm8edhPQUWiFSnNcVIbKIiXq4Nwm0m/AlqtkfkVMaPqTJ0FOkdT3 fHKxFfLWoEClGCXeuCoy3nUCyyg+UPQHWtHuQF5oplzz3o8ppM1BE7NBIJwH08emVPXx nBWju3VITUqttntzji1RDnMsMIRrJd0vBY8MMKeXdyX+tI/dX3H0zCr0FX68kkGFX/DA h4Ug== X-Gm-Message-State: AOAM531P8WVX8PMTlxbyK94rNaafYa331GvxvnuG23NASE1U5Wie4ctQ ZqLh8Jf6XwATnjScRMhUOgCz8u+AIAT398VQTv/9OhKJ5LVGivSH3/eq60COTPNgfCOb4dU6nRV u8lTClJIV8meDWTMEJJG4/LN2wb9Qj3c= X-Received: by 2002:a25:1344:: with SMTP id 65mr35216310ybt.468.1637318615432; Fri, 19 Nov 2021 02:43:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzFUoJ4CsMtgJhZd+YuDbAEwcMsusWgSMkQLbik4xRs9YFHEXMrpLh6Qt15VU6srZPbFkek5XgptMKeWyr62TU= X-Received: by 2002:a25:1344:: with SMTP id 65mr35216283ybt.468.1637318615190; Fri, 19 Nov 2021 02:43:35 -0800 (PST) MIME-Version: 1.0 References: <5f218fb2-57ba-06c9-1821-86d3ded43bf7@gmail.com> In-Reply-To: <5f218fb2-57ba-06c9-1821-86d3ded43bf7@gmail.com> From: Jonathan Wakely Date: Fri, 19 Nov 2021 10:43:24 +0000 Message-ID: Subject: Re: [PATCH][_GLIBCXX_DEBUG] Limit performance impact in __erase_nodes_if To: =?UTF-8?Q?Fran=C3=A7ois_Dumont?= Cc: "libstdc++@gcc.gnu.org" , gcc-patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=unavailable autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Nov 2021 10:43:39 -0000 On Thu, 18 Nov 2021 at 22:05, Fran=C3=A7ois Dumont via Libstdc++ < libstdc++@gcc.gnu.org> wrote: > Hi > > Here is a proposal to limit performance impact of _GLIBCXX_DEBUG > mode on __erase_nodes_if. > > As you can see I am adding erase overloads on the Debug container > to accept base iterators. So it exposes an additional non-Standard > method, do you think it is any issue. > I think this is fine - I can't think of a way that this could make user code do the wrong thing. > > Note that I've started doing something similar for the vector/deque > adding this time erase(_Base_const_iterator, _Base_const_iterator) > overloads. But in this case it results in ambiguous erase calls, even if > I remove the _Safe_iterator cast operator to the base iterator. > > libstdc++: [_GLIBCXX_DEBUG] Reduce performance impact on std::erase_= if > > Bypass the _GLIBCXX_DEBUG additional checks in > std::__detail::__erase_node_if used > by all implementations of std::erase_if for node based containers. > > libstdc++-v3/ChangeLog: > > * include/bits/erase_if.h (__erase_nodes_if): Add > _UnsafeContainer template > parameter. Use it to get iterators to work with. > * include/debug/macros.h (__glibcxx_check_erase2): New. > * include/debug/map.h (map<>::erase(_Base_const_iterator)): > New. > (map<>::erase(const_iterator)): Use latter. > * include/debug/multimap.h > (multimap<>::erase(_Base_const_iterator)): New. > (multimap<>::erase(const_iterator)): Use latter. > * include/debug/multiset.h > (multiset<>::erase(_Base_const_iterator)): New. > (multiset<>::erase(const_iterator)): Use latter. > * include/debug/set.h (set<>::erase(_Base_const_iterator)): > New. > (set<>::erase(const_iterator)): Use latter. > * include/debug/unordered_map > (unordered_map<>::erase(_Base_const_iterator)): New. > (unordered_multimap<>::erase(const_iterator)): New. > * include/debug/unordered_set > (unordered_set<>::erase(_Base_const_iterator)): New. > (unordered_multiset<>::erase(const_iterator)): New. > * include/experimental/map (erase_if): Adapt. > * include/experimental/set (erase_if): Adapt. > * include/experimental/unordered_map (erase_if): Adapt. > * include/experimental/unordered_set (erase_if): Adapt. > * include/std/map (erase_if): Adapt. > * include/std/set (erase_if): Adapt. > * include/std/unordered_map (erase_if): Adapt. > * include/std/unordered_set (erase_if): Adapt. > > Tested under Linux x86_64, > > Ok to commit ? > OK, thanks.