public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jason at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/104719] Use of `std::move` in libstdc++ leads to worsened debug performance
Date: Thu, 10 Mar 2022 23:04:51 +0000 [thread overview]
Message-ID: <bug-104719-4-Kj3W68nERP@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104719-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104719
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #12 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Vittorio Romeo from comment #9)
> - For the `operator[]` benchmark, when using `-Og` after applying
> `[[gnu::always_inline]]` to all the functions touched by the benchmark, we
> reduce the overhead from 34% to around 11%.
Quoting from your gist:
-Og, without `[[gnu::always_inline]]` on `operator[]`
carray_squareop_mean 440 ns 439 ns 3
vector_squareop_mean 661 ns 662 ns 3
-Og, with `[[gnu::always_inline]]` on `operator[]`
vector_squareop_mean 494 ns 491 ns 3
Which looks significant...
...but I don't see this when I run your test myself; the vector_squareop
results (and the generated code) are unaffected by adding always_inline. In
particular there are no calls to operator[].
carray_squareop 547 ns 546 ns 1272023
vector_squareop 591 ns 589 ns 1227215
carray:
movslq %edx, %rax
leaq (%rbx,%rax,4), %rcx
movl (%rcx), %eax
addl $1, %eax
movl %eax, (%rcx)
movl %eax, (%rcx)
addl $1, %edx
vector:
movslq %ecx, %rax
salq $2, %rax
addq (%rsp), %rax
movl (%rax), %esi
leal 1(%rsi), %edx
movl %edx, (%rax)
movl %edx, (%rax)
addl $1, %ecx
It seems the main difference between the two is that the vector version needs
to keep loading the base pointer from the stack (%rsp) for some reason, rather
than keep it in a register %rbx. This doesn't seem like an inlining issue at
all.
The double move in both versions is curious.
next prev parent reply other threads:[~2022-03-10 23:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-28 16:20 [Bug libstdc++/104719] New: " vittorio.romeo at outlook dot com
2022-02-28 16:46 ` [Bug libstdc++/104719] " redi at gcc dot gnu.org
2022-02-28 16:50 ` redi at gcc dot gnu.org
2022-02-28 16:56 ` egallager at gcc dot gnu.org
2022-02-28 17:00 ` vittorio.romeo at outlook dot com
2022-02-28 17:16 ` redi at gcc dot gnu.org
2022-02-28 17:20 ` vittorio.romeo at outlook dot com
2022-02-28 17:24 ` redi at gcc dot gnu.org
2022-02-28 17:37 ` redi at gcc dot gnu.org
2022-03-01 2:23 ` vittorio.romeo at outlook dot com
2022-03-01 20:12 ` redi at gcc dot gnu.org
2022-03-01 20:14 ` redi at gcc dot gnu.org
2022-03-10 23:04 ` jason at gcc dot gnu.org [this message]
2022-03-26 23:37 ` jason at gcc dot gnu.org
2022-03-27 7:35 ` redi at gcc dot gnu.org
2022-05-04 15:34 ` cvs-commit at gcc dot gnu.org
2022-05-04 15:34 ` cvs-commit at gcc dot gnu.org
2022-05-04 15:49 ` unlvsur at live dot com
2022-05-04 15:55 ` redi at gcc dot gnu.org
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=bug-104719-4-Kj3W68nERP@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@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).