public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Arsen Arsenović" <arsen@aarsen.me>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org
Subject: Re: [PATCH 2/2] libstdc++: Replace all manual FTM definitions and use
Date: Mon, 07 Aug 2023 19:38:03 +0200	[thread overview]
Message-ID: <86v8dqu4ef.fsf@aarsen.me> (raw)
In-Reply-To: <CACb0b4ncxaAcLVcQcSAJdEx7bghmmNYOj7LkOHka7x1qd2buqQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1820 bytes --]


Jonathan Wakely <jwakely@redhat.com> writes:

> On Sat, 29 Apr 2023 at 11:24, Arsen Arsenović via Libstdc++ <
> libstdc++@gcc.gnu.org> wrote:
>
>> libstdc++-v3/ChangeLog:
>>
>>         * libsupc++/typeinfo: Switch to bits/version.h for
>>         __cpp_lib_constexpr_typeinfo.
>>
>>
> Does this change have an impact on compilation speed?
> With this change we'll be re-including bits/version.h multiple times in
> most compilations, and unlike other headers the preprocessor can't optimize
> away the second and subsequent times its' included, because the header
> isn't idempotent.
> It will only affect the preprocessing phase, which is a fraction of the
> time taken by template instantiation and middle end optimizations, but I'd
> like to know it's not *too* expensive before committing to this approach.
>

Whoops, I forgot to provide these measurements.

  ~/gcc/build$ time for x in $(seq 1 100); do _pfx/bin/g++ -x c++ - \
               -S -o /dev/null <<< '#include <bits/stdc++.h>'; done
  
  real	3m4.104s
  user	2m53.394s
  sys	0m10.132s

  ~/gcc/pristine-bld$ time for x in $(seq 1 100); do _pfx/bin/g++ \
               -x c++ - -S -o /dev/null \
               <<< '#include <bits/stdc++.h>'; done
  
  real	2m56.430s
  user	2m46.898s
  sys	0m8.967s

The top is a build of gcc with (a rebase of) this patchset, and the
bottom is the merge base.  The configuration for both was:

  ../configure --enable-languages=c++ \
               --disable-libsanitizers \
               --prefix="$(pwd)/_pfx"

This should imply that the difference is minor compared to compilation
time.

Of course, for preprocessing, the difference is far more significant
(same testcase, but with -E): 0m17.248s vs 0m28.382s.

This seems okay to me.
-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

  parent reply	other threads:[~2023-08-07 17:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-29 10:16 [PATCH 0/2] Unify and deduplicate FTM code Arsen Arsenović
2023-04-29 10:16 ` [PATCH 1/2] libstdc++: Implement more maintainable <version> header Arsen Arsenović
2023-06-01 20:06   ` Jonathan Wakely
2023-08-07 17:22     ` Arsen Arsenović
2023-04-29 10:16 ` [PATCH 2/2] libstdc++: Replace all manual FTM definitions and use Arsen Arsenović
2023-06-01 20:30   ` Jonathan Wakely
2023-08-07 17:34     ` Arsen Arsenović
2023-08-07 17:38     ` Arsen Arsenović [this message]
2023-05-08 23:08 ` Ping: [PATCH 0/2] Unify and deduplicate FTM code Arsen Arsenović

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=86v8dqu4ef.fsf@aarsen.me \
    --to=arsen@aarsen.me \
    --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).