in reply to How to decide the size of block in file transferring?

Actually you would be better to use File::Copy. Trying to figure out an optimum block size is a tricky thing that depends on factors within the operating and file systems that you probably don't have easy access to, are likely highly volatile and are certainly not portable.


Perl reduces RSI - it saves typing
  • Comment on Re: How to decide the size of block in file transferring?

Replies are listed 'Best First'.
Re^2: How to decide the size of block in file transferring?
by ccn (Vicar) on Nov 18, 2008 at 06:43 UTC

    There simple logic for block size choosing in File::Copy:
    Unless given as parameter the block size choosen accordingly to size of the copied file up to 2MB. If the file length less than 512 bytes then the size is set to 1024.

    So if OP will use File::Copy than he never know if optimal size more than 2MB. :)

      Optimal size is likely to be an order of magnitude smaller than 2 MB. Beyond a few tens of KB any gains are likely to be very small. At some point swapping will become an issue with a dramatic decrease in throughput. Allowing a 2 MB buffer seems fairly generous given the current state of technology and even just a few years ago would have been ridiculously large.


      Perl reduces RSI - it saves typing
Re^2: How to decide the size of block in file transferring?
by BrowserUk (Patriarch) on Nov 18, 2008 at 06:50 UTC

      There is no tracking call back, but File::Copy does provide syscopy which will use an OS provided file copy for Win32, VMS and OS/2 and will fall back to its normal copy for *nix.


      Perl reduces RSI - it saves typing