in reply to Re: How smart is 'seek $fh, $pos, 0'?
in thread How smart is 'seek $fh, $pos, 0'?

I'm getting 7, 8, 5, 12 on cygwin Perl 5.14.4, 25MB file.

Update: Interestingly, I'm getting 7, 8, 6, 12 with 1GB file, too.

Update #2: 7, 8, 9, 14 with 10GB.

Update #3: back at home. My Linux desktop, 24GB file:

1.68571901321411 1.60926795005798 1.60942387580872 1.69600319862366
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^3: How smart is 'seek $fh, $pos, 0'?
by BrowserUk (Patriarch) on May 27, 2015 at 14:14 UTC
    I'm getting 7, 8, 5, 12 on cygwin Perl 5.14.4, 25MB file.

    I did it on an 8GB file to (attempt) to prevent caching mucking with the numbers.

    And I'm sure that the values will vary depending upon the file (fragmented or not), device(disk/ssd/etc), version of perl, compiler/CRT, but the numbers are pretty consistent across all my devices and have been for several version of perl.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    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". I'm with torvalds on this
    In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked
Re^3: How smart is 'seek $fh, $pos, 0'?
by BrowserUk (Patriarch) on May 27, 2015 at 15:20 UTC
    Update: Interestingly, I'm getting 7, 8, 6, 12 with 1GB file, too.

    Still probably too small to prevent the entire file being cached. (Unless you have less that about 2GB ram?)

    Even so, I can't reason an explanation for why seek backwards relative would be faster than forwards.

    If you have the ability to run that utility that traces system calls (strace?), that might reveal something.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    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". I'm with torvalds on this
    In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked