From: Ken Matsui <kmatsui@cs.washington.edu>
To: Patrick Palka <ppalka@redhat.com>
Cc: Jonathan Wakely <jwakely.gcc@gmail.com>,
Xi Ruoyao <xry111@xry111.site>,
gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org
Subject: Re: [PATCH] libstdc++: use new built-in trait __is_reference
Date: Mon, 20 Mar 2023 13:24:44 -0700 [thread overview]
Message-ID: <CAML+3pV_j_=kOAGE6Vd=AL1DXw8A9qx_bj37Rh7K6LsxbJ=fEw@mail.gmail.com> (raw)
In-Reply-To: <CAMOnLZZ380BbahHHuPYss5jFBGnJ59z0qNQZp8PFXZhrwXM4Ug@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3980 bytes --]
Thank you so much for taking the benchmark! This is a great improvement
than I thought.
In GCC contributions, do I need to benchmark (and report) every built-in
trait I implement?
On Mon, Mar 20, 2023 at 8:24 AM Patrick Palka <ppalka@redhat.com> wrote:
> On Mon, Mar 20, 2023 at 5:56 AM Ken Matsui <kmatsui@cs.washington.edu>
> wrote:
> >
> > > Does it actually make compilation faster though?
> > >
> > > Has it been measured?
> >
> > In my understanding, what I have implemented so far is so simple that
> > it does not affect the speed. These traits are what Partick kindly
> > recommended to get started. As explained on the GSoC page, some traits
> > might involve expensive instantiation of multiple class templates. So
> > IMHO, implementing built-in traits for those traits can make
> > compilation cheaper.
> >
> > I have not measured it, but Patrick might have done?
>
> Although the native implementation of using two partial
> specializations is very efficient, I'd suspect using a built-in would
> be even better because it'd avoid the work of having to figure out
> which of the two partial specializations to instantiate.
>
> I contrived the attached benchmark to measure this, which instantiates
> ~160k specializations of is_reference_v (it was simpler to write a
> benchmark for the variable template version). On my machine gcc trunk
> (release build) as well as Clang 15 use between 10-15% less
> time/memory with -DUSE_BUILTIN than without for this benchmark, so
> this suggests the built-in improves compile time/memory usage for this
> trait by at least 10-15%. For more complicated traits the improvement
> should be even better.
>
> >
> > On Mon, Mar 20, 2023 at 2:14 AM Jonathan Wakely <jwakely.gcc@gmail.com>
> wrote:
> > >
> > > On Mon, 20 Mar 2023 at 08:08, Xi Ruoyao via Libstdc++
> > > <libstdc++@gcc.gnu.org> wrote:
> > > >
> > > > On Mon, 2023-03-20 at 01:03 -0700, Ken Matsui wrote:
> > > > > Oops, I assumed those were my email... Thank you for your heads up
> and
> > > > > your comments!
> > > > >
> > > > > > Bad ChangeLog format. You should have a tab (not 4 or 8 spaces,
> nor
> > > > > > nothing) to indent the ChangeLog content.
> > > > >
> > > > > Do you mean like the following?
> > > > >
> > > > > ```
> > > > > libstdc++-v3/ChangeLog:
> > > > >
> > > > > [TAB]* include/std/type_traits (is_reference): Use __is_reference
> > > > > built-in
> > > > > trait.
> > > > > ```
> > > >
> > > > Yep.
> > > >
> > > > > > Is there any benefit to use a builtin, instead of the existing
> > > > > > implementation? I can see no but maybe I'm stupid.
> > > > >
> > > > > My patches are based on the GSoC project "C++: Implement compiler
> > > > > built-in traits for the standard library traits". These built-in
> > > > > traits basically make the compilation faster.
> > > > >
> > > > > https://gcc.gnu.org/wiki/SummerOfCode
> > > >
> > > > Ok, to me making compilation faster is a valid reason.
> > >
> > > Does it actually make compilation faster though?
> > >
> > > Has it been measured?
> > >
> > > > > > The patch fails to apply. It seems because your mail client
> inserted an
> > > > > > additional newline before "b/". Try to use git-send-email or
> configure
> > > > > > the mail client properly.
> > > > >
> > > > > Let me try to use git-send-email instead. I stupidly don't
> understand
> > > > > how to use them, so I was making my patches manually...
> > > >
> > > > Or adjust the mail client correctly. You can send the patch to
> yourself
> > > > first and see if it's not "mangled" by the mail client when you debug
> > > > such an issue...
> > > >
> > > > But when you finally end up sending 10 patches in a series you'll
> find
> > > > git send-email much easier :).
> > >
> > > Figuring out how to generate proper patches is an important part of
> > > contributing to GCC, so part of any GSoC project.
> >
>
prev parent reply other threads:[~2023-03-20 20:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-19 4:21 Ken Matsui
2023-03-20 7:25 ` Xi Ruoyao
2023-03-20 7:30 ` Ken Matsui
2023-03-20 7:51 ` Xi Ruoyao
2023-03-20 8:03 ` Ken Matsui
2023-03-20 8:07 ` Xi Ruoyao
2023-03-20 8:32 ` Ken Matsui
2023-03-20 9:14 ` Jonathan Wakely
2023-03-20 9:56 ` Ken Matsui
2023-03-20 13:22 ` Ken Matsui
2023-03-20 15:23 ` Patrick Palka
2023-03-20 20:24 ` Ken Matsui [this message]
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='CAML+3pV_j_=kOAGE6Vd=AL1DXw8A9qx_bj37Rh7K6LsxbJ=fEw@mail.gmail.com' \
--to=kmatsui@cs.washington.edu \
--cc=gcc-patches@gcc.gnu.org \
--cc=jwakely.gcc@gmail.com \
--cc=libstdc++@gcc.gnu.org \
--cc=ppalka@redhat.com \
--cc=xry111@xry111.site \
/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).