This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Default buffer size of class basic_filebuf


Am 27. April 2012 13:45 schrieb Weber, Peter (Wilken GmbH)
<peter.weber@wilken.de>:
> I want to figure out the default buffer-size of the class basic_filebuf.
> I know the member function pubsetbuf() and it seems to have a great
> impact on the performance during file copy.
>
> Question: Where I can find the default buffer size for basic_filebuf?

I don't think that the standard gives you a reasonable answer to this question.

> The standard for C++ doesn't define a member function pubgetbuf() or
> something like this, also the member function is_avail() doesn't help
> either. I can't find any constant. I know BUFSIZ from <cstdio> and it
> defaults on my machine to 8192 Bytes, which performs well for me with
> fread()/fwrite() and read()/write().
>
> I doing some testing on simple file copying:
> http://stackoverflow.com/questions/10195343/copy-a-file-in-an-sane-safe-and-efficient-way

I suggest to keep an eye on the filesystem proposal. Among other useful
functions it provides a simple file copy functionality:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3365.html#copy_file

This delegates responsibility of such non-portable things to the implementation.

- Daniel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]