<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - unordered_set's operator= or insert() is slower without a reserve before it"
href="https://llvm.org/bugs/show_bug.cgi?id=31153">31153</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>unordered_set's operator= or insert() is slower without a reserve before it
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>arphaman@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=17643" name="attach_17643" title="A sample file that reproduces this problem">attachment 17643</a> <a href="attachment.cgi?id=17643&action=edit" title="A sample file that reproduces this problem">[details]</a></span>
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).</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>