<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Degraded performance after closing and opening a filebuf"
href="https://bugs.llvm.org/show_bug.cgi?id=44194">44194</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Degraded performance after closing and opening a filebuf
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>9.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</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>alex@grundis.de
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>When creating a `std::filebuf` an internal buffer of size 4kB is allocated and
used for reading/writing. On calling `close` on that filebuf that buffer is
deallocated falling back to a small internal buffer (8B IIRC). This is then
used for reading/writing when opening a new file with `std::filebuf::open`.
This small buffer leads to way worse performance than the original 4kB buffer.
I'm considering this a bug, as at least the users expectation would be to that
close and reopen a filebuf would be cheaper than recreating the whole instance.
This matters e.g. when using the filebuf in a loop.
Note: As filebuf is used by [io]fstream, the argument does apply to all
standard fstreams.</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>