On windows (and probably all filesystems), I'd strongly suggest that you avoid such arbitrary math which will result in weird blocksizes and instead opt for some multiple of the filesystems inherent read size which is generally 4096 bytes (under NTFS). I've also found that throughput gains tend to tail off rapidly as the blocksize grows, with 64kb usually seeming to give the best read/write performance.

You should also ensure that you read/write the files in binary, (':raw'), even if they are text files as there is a substantial overhead in crlf translations, which are redundant for disk to disk transfers.

The only merit I see in the /10 strategy is that it makes the progress calculations simple. And that seems no good reason at all to suffer the cost of partial block reads and writes.

Also, if this were purely for Windows, then I'd use CopyFileEx which provides a callback for progress monitoring and display, and is likely far more efficient than you could write at the Perl level. But you seem to be looking for portablility?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

In reply to Re: How to decide the size of block in file transferring? by BrowserUk
in thread How to decide the size of block in file transferring? by SadEmperor

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.