public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Barnabás Pőcze" <pobrn@protonmail.com>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH v1] libstdc++: Optimize removal from unique assoc containers [PR112934]
Date: Fri, 15 Mar 2024 02:06:29 +0000	[thread overview]
Message-ID: <xjRKSLV8rDgsqlkmm2ZGEW9E4J1L0ftLX4N0iH_EzfbNMg9oeCE5EY0Ti9wfQMeO5DmQep58sJjRQ8NASYLlH_qIAQ17WBWbOjkoCSB-rt0=@protonmail.com> (raw)
In-Reply-To: <CACb0b4nkNS3MdhLap7vFqS7YxKcTGJQy80UAy-FEkOvG3B7+eQ@mail.gmail.com>

Hi


2024. március 13., szerda 12:43 keltezéssel, Jonathan Wakely <jwakely@redhat.com> írta:

> On Mon, 11 Mar 2024 at 23:36, Barnabás Pőcze <pobrn@protonmail.com> wrote:
> >
> > Previously, calling erase(key) on both std::map and std::set
> > would execute that same code that std::multi{map,set} would.
> > However, doing that is unnecessary because std::{map,set}
> > guarantee that all elements are unique.
> >
> > It is reasonable to expect that erase(key) is equivalent
> > or better than:
> >
> >   auto it = m.find(key);
> >   if (it != m.end())
> >     m.erase(it);
> >
> > However, this was not the case. Fix that by adding a new
> > function _Rb_tree<>::_M_erase_unique() that is essentially
> > equivalent to the above snippet, and use this from both
> > std::map and std::set.
> 
> Hi, this change looks reasonable, thanks for the patch. Please note
> that GCC is currently in "stage 3" of its dev process so this change
> would have to wait until after GCC 14 branches from trunk, due in a
> few weeks.

OK; I didn't know that, thanks for telling me.


> 
> I assume you ran the testsuite with no regressions. [...]


I hope so. I ran `make check-target-libstdc++-v3`, and it did not note any
unexpected failures as far as I can see:

  Native configuration is x86_64-pc-linux-gnu

  		=== libstdc++ tests ===

  Schedule of variations:
      unix

  Running target unix
  Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
  Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
  Using /gcc/libstdc++-v3/testsuite/config/default.exp as tool-and-target-specific interface file.
  Running /gcc/libstdc++-v3/testsuite/libstdc++-abi/abi.exp ...
  Running /gcc/libstdc++-v3/testsuite/libstdc++-dg/conformance.exp ...
  Running /gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/prettyprinters.exp ...
  Running /gcc/libstdc++-v3/testsuite/libstdc++-xmethods/xmethods.exp ...

  		=== libstdc++ Summary ===

  # of expected passes		18646
  # of expected failures		126
  # of unsupported tests		672

> [...] Do you have benchmarks to show this making a difference?


As for benchmarks, I do not have any. But even if the performance does not
improve appreciably, the size of the generated code will definitely be smaller.
And in the end, the excessive code was the reason I opened the mentioned issue[0]
in the first place, which should be eliminated hopefully.


> [...]


Regards,
Barnabás Pőcze


[0]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112934

  reply	other threads:[~2024-03-15  2:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-11 23:35 Barnabás Pőcze
2024-03-13 11:43 ` Jonathan Wakely
2024-03-15  2:06   ` Barnabás Pőcze [this message]
2024-05-18  1:01   ` Barnabás Pőcze
2024-06-14 22:00     ` Barnabás Pőcze

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='xjRKSLV8rDgsqlkmm2ZGEW9E4J1L0ftLX4N0iH_EzfbNMg9oeCE5EY0Ti9wfQMeO5DmQep58sJjRQ8NASYLlH_qIAQ17WBWbOjkoCSB-rt0=@protonmail.com' \
    --to=pobrn@protonmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely@redhat.com \
    --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).