public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "devison at pacificit dot co dot nz" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/13823] Significant performance issue with std::map on multiple threads on dual processor - possibly default allocator Date: Fri, 23 Jan 2004 05:31:00 -0000 [thread overview] Message-ID: <20040123053126.26291.qmail@sources.redhat.com> (raw) In-Reply-To: <20040123001452.13823.devison@pacificit.co.nz> ------- Additional Comments From devison at pacificit dot co dot nz 2004-01-23 05:31 ------- Subject: Re: Significant performance issue with std::map on multiple threads on dual processor - possibly default allocator Hi, I obtained the latest ext/mt_allocator.h file from cvs, and reran the test using it. Otherwise I'm still using the gcc 3.3.2 headers. BTW, I needed to make one addition to make it compile: namespace __gnu_cxx { using std::__throw_bad_alloc; } On my machine, it showed an improvement of around 30%, which is good, but is still running into a significant bottleneck. (Still 4 times slower than on a single cpu). Has anyone seen other results? By the way, while this example program is a little perverse, I was getting a similar performance hit in my application in which I was trying to speed things up with a second calculation thread. The calculations I am doing require creating tables of temporary results. thanks, Dan ----- Original Message ----- From: "ljrittle at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: <devison@pacificit.co.nz> Sent: Friday, January 23, 2004 4:58 PM Subject: [Bug libstdc++/13823] Significant performance issue with std::map on multiple threads on dual processor - possibly default allocator > > ------- Additional Comments From ljrittle at gcc dot gnu dot org 2004-01-23 03:58 ------- > Try this (we might change the default allocator to make it work better for MP > at the next major library revision --- ABI change, but 3.4 will support this > allocator > with very good performance for people that wish to tune their application): > > #include <iostream> > #include <map> > #include <ext/mt_allocator.h> > > void *calc(void *n) > { > std::map<int, int, std::less<const int>, > __gnu_cxx::__mt_alloc< std::pair<const int, int> > > m; > > for (unsigned i = 0; i < 100000; ++i) > m[i] = i; > > return 0; > } > > int main(int argc, char *argv[]) > { > int n = argc == 2 ? std::max(atoi(argv[1]), 1) : 2; > > pthread_t id[n]; > > for (int i = 0; i < n; ++i) > pthread_create(&id[i], 0, calc, new int(i)); > > for (int i = 0; i < n; ++i) > pthread_join(id[i], 0); > > return 0; > } > > -- > What |Removed |Added > -------------------------------------------------------------------------- -- > Status|NEW |SUSPENDED > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13823 > > ------- You are receiving this mail because: ------- > You reported the bug, or are watching the reporter. > > -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13823
next prev parent reply other threads:[~2004-01-23 5:31 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-01-23 0:15 [Bug c++/13823] New: " devison at pacificit dot co dot nz 2004-01-23 0:18 ` [Bug c++/13823] " devison at pacificit dot co dot nz 2004-01-23 0:49 ` richard at redspider dot co dot nz 2004-01-23 2:34 ` [Bug libstdc++/13823] " pinskia at gcc dot gnu dot org 2004-01-23 2:41 ` devison at pacificit dot co dot nz 2004-01-23 2:44 ` pinskia at gcc dot gnu dot org 2004-01-23 3:26 ` rittle at latour dot rsch dot comm dot mot dot com 2004-01-23 3:38 ` ljrittle at gcc dot gnu dot org 2004-01-23 3:58 ` devison at pacificit dot co dot nz 2004-01-23 3:58 ` ljrittle at gcc dot gnu dot org 2004-01-23 4:14 ` rittle at latour dot rsch dot comm dot mot dot com 2004-01-23 5:31 ` devison at pacificit dot co dot nz [this message] 2004-01-23 6:01 ` rittle at latour dot rsch dot comm dot mot dot com 2004-01-23 12:48 ` devison at pacificit dot co dot nz 2004-01-23 20:47 ` rittle at latour dot rsch dot comm dot mot dot com [not found] <bug-13823-4@http.gcc.gnu.org/bugzilla/> 2024-06-13 14:30 ` 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=20040123053126.26291.qmail@sources.redhat.com \ --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: linkBe 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).