This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Default buffer size of class basic_filebuf
- From: Daniel Krügler <daniel dot kruegler at googlemail dot com>
- To: "Weber, Peter (Wilken GmbH)" <peter dot weber at wilken dot de>
- Cc: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>
- Date: Fri, 27 Apr 2012 14:41:11 +0200
- Subject: Re: Default buffer size of class basic_filebuf
- References: <1335527132.1822.33.camel@ws-lnx-pew>
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