<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 - i/o fragmentation inside fstream."
href="https://bugs.llvm.org/show_bug.cgi?id=35629">35629</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>i/o fragmentation inside fstream.
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>5.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>pawel_sikora@zoho.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>i'm trying to minimize small i/o operations for better overall application
performance over network filesystem. setting quite large stream buffer doesn't
work as axpected.
% cat t.cpp
#include <fstream>
#include <memory>
#include <string>
int main()
{
std::size_t bufferSize = 1024*1024;
std::unique_ptr< char > buffer( new char[ bufferSize ] );
std::ofstream f;
f.rdbuf()->pubsetbuf( buffer.get(), bufferSize );
f.open( "s.txt", std::ios_base::out | std::ios_base::binary );
std::string s1( 10240, 'x' );
f << s1;
f << s1;
f.close();
}
% ~/toolchain/llvm/sysroot/bin/clang++ t.cpp -o t
-Wl,-rpath,$HOME/toolchain/llvm/sysroot/lib -std=c++1y -stdlib=libc++ -ggdb
% strace ./t 2>&1 |grep write
write(3, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"..., 4096) = 4096
write(3, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"..., 16384) = 16384
% g++ t.cpp -o t -std=c++1y // g++ from fedora-27
% strace ./t 2>&1 |grep write
writev(3, [{iov_base=NULL, iov_len=0},
{iov_base="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"..., iov_len=10240}], 2) = 10240
writev(3, [{iov_base="", iov_len=0},
{iov_base="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"..., iov_len=10240}], 2) = 10240
gcc with my patch from <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63746">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63746</a>:
% ~/toolchain/gcc/sysroot/bin/x86_64-linux-gnu-g++ t.cpp -o t
-Wl,-rpath,$HOME/toolchain/gcc/sysroot/lib64 -std=c++1y
% strace ./t 2>&1 |grep write
write(3, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"..., 20480) = 20480
looks like both standard c++ library implementations need patching in this
area.</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>