You seem to be right: getting the file size is an expensive operation on windows. (BTW, this is with a different file, shimgvw.dll, having about the same size as your words. Also, there's a little bit of cheating here -- I found the best blocksize for sysreadby by testing with every power-of-two from 1 to 512k. Also, numbers with open/read vs. sysopen/sysread were about the same, so only the sysfoo number are here.) My final numbers:

Benchmark: running join, slurp, sysread_wholefile, sysreadby32k, while +, each for at least 5 CPU seconds... join: 6 wallclock secs ( 2.98 usr + 2.27 sys = .26 CPU) @ 5320 +.53/s (n=27970) slurp: 5 wallclock secs ( 2.55 usr + 2.76 sys = .32 CPU) @ 6339 +.04/s (n=33711) sysread_wholefile: 6 wallclock secs ( 0.39 usr + 4.89 sys = 5.28 CP +U) @ 360.93/s (n=1905) sysreadby32k: 5 wallclock secs ( 2.35 usr + 2.97 sys = 5.33 CPU) @ 6 +879.48/s (n=36647) while: 6 wallclock secs ( 3.07 usr + 2.19 sys = .26 CPU) @ 531 +9.51/s (n=27970) Rate sysread_wholefile while join slurp sy +sreadby32k sysread_wholefile 361/s -- -93% -93% -94% + -95% while 5320/s 1374% -- -0% -16% + -23% join 5321/s 1374% 0% -- -16% + -23% slurp 6339/s 1656% 19% 19% -- + -8% sysreadby32k 6879/s 1806% 29% 29% 9% + --
TACCTGTTTGAGTGTAACAATCATTCGCTCGGTGTATCCATCTTTG ACACAATGAATCTTTGACTCGAACAATCGTTCGGTCGCTCCGACGC

In reply to Re: Re: Re: Re: Reading entire file into scalar: speed differences? by theorbtwo
in thread Reading entire file into scalar: speed differences? by theguvnor

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.