From: Licht Martin Werner <martin.licht@epfl.ch>
To: <gcc-help@gcc.gnu.org>
Subject: Do definitions in headers still help optimization?
Date: Fri, 12 Jan 2024 15:07:43 +0100 [thread overview]
Message-ID: <be3815ac-bb30-4297-bcfe-3873c850378c@epfl.ch> (raw)
Dear all,
Does keeping definitions of functions in header files still help the
compiler optimize your code? Or is that advice outdated?
The answer used to be a certain yes when all optimizations were
exclusive to the translation unit. By now, link-time optimization has
been a thing for a while, and one might imagine that defining functions
in header does not make a difference for optimization anymore.
(Of course, placing functions in header files or asking for link-time
optimization will affect the compilation speed and memory use)
Discussions of this question seem to be based on hearsay, so I'd rather
hope for an answer straight from the source. Thanks.
Martin
next reply other threads:[~2024-01-12 14:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-12 14:07 Licht Martin Werner [this message]
2024-01-12 14:49 ` LIU Hao
2024-01-12 16:01 ` Xi Ruoyao
2024-01-12 17:58 ` LIU Hao
2024-01-14 10:44 ` Xi Ruoyao
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=be3815ac-bb30-4297-bcfe-3873c850378c@epfl.ch \
--to=martin.licht@epfl.ch \
--cc=gcc-help@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).