From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5851 invoked by alias); 7 Feb 2004 08:07:46 -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 5844 invoked by uid 48); 7 Feb 2004 08:07:45 -0000 Date: Sat, 07 Feb 2004 08:07:00 -0000 From: "ctsa at u dot washington dot edu" To: gcc-bugs@gcc.gnu.org Message-ID: <20040207080740.14061.ctsa@u.washington.edu> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug libstdc++/14061] New: poor performance of std::sort on large lexicographic c-string sort X-Bugzilla-Reason: CC X-SW-Source: 2004-02/txt/msg00858.txt.bz2 List-Id: I've encountered a performance bug for string sorting using std::sort which I can't diagnose; this has been reduced to a minimal testcase which compares std::sort and qsort: sort_bug.cc """ #include #include #include #include int cmpcount = 0; int qsort_cmp(const void* ptr1,const void* ptr2){ if( (++cmpcount)%100000 == 0 ) std::cerr << cmpcount << std::endl; return( strcmp(*((char**) ptr1),*((char**) ptr2))); } struct functor_cmp { bool operator()(const char* a, const char* b){ if( (++cmpcount)%100000 == 0 ) std::cerr << cmpcount << std::endl; return strcmp(a,b) == -1; } }; int main() { const int len = 1000000; char* big_str = new char[len]; for(int i=0;i