[llvm-bugs] [Bug 44194] New: Degraded performance after closing and opening a filebuf
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Dec 1 05:37:27 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=44194
Bug ID: 44194
Summary: Degraded performance after closing and opening a
filebuf
Product: libc++
Version: 9.0
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: alex at grundis.de
CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
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.
--
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/20191201/88c6644a/attachment.html>
More information about the llvm-bugs
mailing list