[LLVMbugs] [Bug 14554] New: libc++'s map is 37% slower than libstdc++'s from gcc4.2

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Dec 9 11:08:12 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=14554

             Bug #: 14554
           Summary: libc++'s map is 37% slower than libstdc++'s from
                    gcc4.2
           Product: libc++
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
        AssignedTo: hhinnant at apple.com
        ReportedBy: nicolasweber at gmx.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


I'm running one of the programs from
http://www.cs.bell-labs.com/cm/cs/pearls/sec151.html with this input file
http://www.gutenberg.org/files/30/old/bible11.txt

This is with Xcode

The program takes 0.4s with Xcode 4.5.2's clang and libstdc++, but 0.56s with
libc++:

/*
   $ clang++ -o s151_map sec151_stlmap.cpp -O2
   $ time ./s151_map < ~/Downloads/bible11.txt > /dev/null

   real    0m0.403s
   user    0m0.396s
   sys    0m0.006s

   $ clang++ -o s151_map sec151_stlmap.cpp -O2 -stdlib=libc++
   $ time ./s151_map < ~/Downloads/bible11.txt > /dev/null

   real    0m0.557s
   user    0m0.548s
   sys    0m0.005s
 */
#include <iostream>
#include <map>
#include <string>
using namespace std;

int main(void)
{   map<string, int> M;
    map<string, int>::iterator j;
    string t;
    while (cin >> t)
        M[t]++;
    for (j = M.begin(); j != M.end(); ++j)
        cout << j->first << " " << j->second << "\n";
    return 0;
}

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list