public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "François Dumont" <frs.dumont@gmail.com>
To: "libstdc++@gcc.gnu.org" <libstdc++@gcc.gnu.org>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] libstdc++: Limit allocations in _Rb_tree 2/2
Date: Thu, 2 Mar 2023 06:39:30 +0100	[thread overview]
Message-ID: <195c8a11-acc7-1e78-091f-c7417d147e64@gmail.com> (raw)
In-Reply-To: <98823f83-ae62-f3e4-4091-01841b08fbb7@gmail.com>

Just forget about this patch, bad idea.

The key_type might have additional data not used for the comparison. 
This data would not be preserved if we were inserting the already stored 
equivalent key instead of the user provided.


On 22/02/23 07:08, François Dumont wrote:
> This one is a refinement for multimap/multiset.
>
> It allows to have share the same key if managed with ref counting like 
> the cow string.
>
>     libstdc++: [_Rb_tree] Limit allocations on equal insertions [PR 
> 96088]
>
>     When inserting the same key several times prefer to insert the new 
> entry using the
>     current stored key_type instance if this copy is noexcept. 
> Otherwise create a new
>     key instance from input argument.
>
>     libstdc++-v3/ChangeLog:
>
>             PR libstdc++/96088
>             * include/bits/cow_string.h 
> (basic_string<>::basic_string(const basic_string&)):
>             Add noexcept qualification when allocator is always equal.
>             * include/bits/stl_tree.h 
> (_Rb_tree<>::_M_get_insert_equal_pos_tr): New.
>             (_Rb_tree<>::_M_emplace_equal_tr): New, use latter.
>             (_Rb_tree<>::_M_emplace_equal_aux): New, use latter.
> (_Rb_tree<>::_M_emplace_equal<_Arg>(_Arg&&)): New, use latter.
>             * testsuite/23_containers/multimap/96088.cc (test01): Add 
> check on redundant
>             insertion.
>             (test02): Likewise.
>             * testsuite/23_containers/multiset/96088.cc (test01, 
> test02): Likewise.
>
> François



  reply	other threads:[~2023-03-02  5:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-02 18:20 [PATCH] libstdc++: Limit allocations in _Rb_tree François Dumont
     [not found] ` <43172ea5-6729-02c5-d374-9537fff7eb4c@gmail.com>
2023-02-22  6:06   ` [PATCH] libstdc++: Limit allocations in _Rb_tree 1/2 François Dumont
2023-02-22  6:08     ` [PATCH] libstdc++: Limit allocations in _Rb_tree 2/2 François Dumont
2023-03-02  5:39       ` François Dumont [this message]
2023-03-02 10:43         ` Jonathan Wakely
2023-03-06 17:36     ` [PATCH] libstdc++: Limit allocations in _Rb_tree 1/2 Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=195c8a11-acc7-1e78-091f-c7417d147e64@gmail.com \
    --to=frs.dumont@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).