This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/53263] New: priority_queue is very slow if -D_GLIBCXX_DEBUG is used
- From: "dominik dot strasser at onespin-solutions dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 07 May 2012 11:29:25 +0000
- Subject: [Bug libstdc++/53263] New: priority_queue is very slow if -D_GLIBCXX_DEBUG is used
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53263
Bug #: 53263
Summary: priority_queue is very slow if -D_GLIBCXX_DEBUG is
used
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: dominik.strasser@onespin-solutions.com
Created attachment 27332
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27332
Minimalistic example demonstrating the problem
I've measured the most simplistic usage of priority queue.
With 5,000 elements, the run time is:
real 0m0.005s
user 0m0.002s
sys 0m0.002s
With 10,000 elements, the run time is:
real 0m0.006s
user 0m0.002s
sys 0m0.002s
If I switch on -D_GLIBCXX_DEBUG, the situation changes:
5,000 elements:
real 0m11.216s
user 0m11.210s
sys 0m0.003s
10,000 elements:
real 0m48.354s
user 0m48.344s
sys 0m0.003s
20,000 elements:
real 2m56.971s
user 2m56.941s
sys 0m0.002s
So in addition to some overhead, there seems to be some quadratic behavior
inside the debug version as the run time is 4x for 2x elements.