From: Marc Glisse <marc.glisse@inria.fr>
To: libstdc++@gcc.gnu.org
Cc: gcc-patches@gcc.gnu.org
Subject: Re: libstdc++: Speed up push_back
Date: Fri, 24 Nov 2023 20:45:21 +0100 (CET) [thread overview]
Message-ID: <e736b467-fb1c-0483-c21a-ad9dc0c608cd@inria.fr> (raw)
In-Reply-To: <CACb0b4nQ57Y14nLYjFWF1SSE6GJLznd8EOxUckk6mBfGC0HdPg@mail.gmail.com>
On Thu, 23 Nov 2023, Jonathan Wakely wrote:
> That's why we need -fsane-operator-new
Although the standard forbids it, some of us just provide an inline
implementation
inline void* operator new(std::size_t n){return malloc(n);}
inline void operator delete(void*p)noexcept{free(p);}
inline void operator delete(void*p,std::size_t)noexcept{free(p);}
(I could certainly add a check to abort if malloc returns 0 or other
details, depending on what the application calls for)
It used to enable a number of optimizations, for instance in gcc-9
auto f(){ return std::vector<int>(4096); }
was optimized to just one call to calloc (someone broke that in gcc-10).
Using LTO on libsupc++ is related.
I don't know if we want to define "sane" operators new/delete, or just
have a flag that promises that we won't try to replace the default ones.
--
Marc Glisse
next prev parent reply other threads:[~2023-11-24 19:45 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-19 21:53 Jan Hubicka
2023-11-20 12:09 ` Jonathan Wakely
2023-11-20 15:44 ` Jan Hubicka
2023-11-20 16:46 ` Jonathan Wakely
2023-11-21 12:50 ` Jan Hubicka
2023-11-21 13:07 ` Jonathan Wakely
2023-11-23 8:15 ` Matthias Kretz
2023-11-23 15:07 ` Jan Hubicka
2023-11-23 15:33 ` Jan Hubicka
2023-11-23 15:43 ` Jan Hubicka
2023-11-23 16:26 ` Jonathan Wakely
2023-11-23 16:20 ` Jonathan Wakely
2023-11-24 10:21 ` Martin Jambor
2023-11-24 10:23 ` Richard Biener
2023-11-24 19:45 ` Marc Glisse [this message]
2023-11-24 20:07 ` Jan Hubicka
2023-11-24 21:55 ` Jonathan Wakely
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=e736b467-fb1c-0483-c21a-ad9dc0c608cd@inria.fr \
--to=marc.glisse@inria.fr \
--cc=gcc-patches@gcc.gnu.org \
--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).