From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27011 invoked by alias); 23 Jan 2004 03:58:13 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 27001 invoked by uid 48); 23 Jan 2004 03:58:13 -0000 Date: Fri, 23 Jan 2004 03:58:00 -0000 Message-ID: <20040123035813.27000.qmail@sources.redhat.com> From: "ljrittle at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20040123001452.13823.devison@pacificit.co.nz> References: <20040123001452.13823.devison@pacificit.co.nz> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug libstdc++/13823] Significant performance issue with std::map on multiple threads on dual processor - possibly default allocator X-Bugzilla-Reason: CC X-SW-Source: 2004-01/txt/msg02885.txt.bz2 List-Id: ------- 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 #include #include void *calc(void *n) { std::map, __gnu_cxx::__mt_alloc< std::pair > > 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