[llvm-bugs] [Bug 31153] New: unordered_set's operator= or insert() is slower without a reserve before it

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 24 02:33:56 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=31153

            Bug ID: 31153
           Summary: unordered_set's operator= or insert() is slower
                    without a reserve before it
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: arphaman at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
    Classification: Unclassified

Created attachment 17643
  --> https://llvm.org/bugs/attachment.cgi?id=17643&action=edit
A sample file that reproduces this problem

The use of unordered_set's "operator =" or call to "insert" is faster if you
call "reserve" first (using the size of the copied or inserted set). I get
about 10 - 15% improvements with "reserve".

I've attached a sample file that can be used to reproduce this problem. I've
tested it using "clang++ unordered_set_reserve.cpp -O3 -stdlib=libc++
-std=c++11" with ToT clang (r287852) and libcxx (r287829) on macOS (2015
MacBook Pro with 2.8 GHz Quad Core i7).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161124/63604699/attachment.html>


More information about the llvm-bugs mailing list