|
Boost : |
From: Aaron Brashears (gila_at_[hidden])
Date: 2002-03-19 01:24:36
In my tests, I've found a combination of stat, mmap (there's a similar
win32 api), and memcpy to be the fastest implementation available. I
don't have any benchmarks available but it also stands to reason that
handing the file copy routine over to the kernal will yield the best
possible results for a general purpose file copy.
Given that your astoundingly simple implementation is so, well,
simple, it hardly seems to warrent inclusion as a file copy routine
and should just be one of the many tricks in your bag.
On Tue, Mar 19, 2002 at 04:37:33PM +1100, Dylan Nicholson wrote:
> If we definitely decide to put in a "copy_file" routine into boost::filesystem,
> then believe it or not, the following single line of code is remarkably
> efficient (at least under HP aCC 3.33, which is what I tested it with):
>
> bool copy(const char* src, const char* dest)
> {
> return std::ofstream(dest) << std::ifstream(src).rdbuf();
> }
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk