Hi clivehumby,

I think there is something wrong with the I/O here. Perl scalars can hold values up to 2^53 (see maximum value of a scalar for details). For testing purpouses I created two big files F1.DAT and F2.DAT, their size are 1GB and 2GB respectively and modified your code as follows:

use strict; use warnings; my $int2 = 2147483648; my $int4 = 2147483648 * 2; my $int8 = 2147483648 * 4; my $int16 = 2147483648 * 8; print "int2 $int2\n"; print "int4 $int4\n"; print "int8 $int8\n"; print "int16 $int16\n"; ## set up data in memory my $tm=time; my $file= $ARGV[0]; my $data; { open my $fh, '<', $file or die; local $/ = undef; $data = <$fh>; close $fh; } ## report load statistics my $str="XYZ"; my $lx=length($data); my $tmx=time-$tm; my $r=$lx/$tmx; print "File $file cached $lx bytes in $tmx seconds @ $r bs\n";
I run the script with different perl versions and the result can be found below. 5.8.9 and 5.10.1 failed but 5.20.2 worked correctly.
pme@pme-notebook: ~/Develop/workpme@pme-notebook:~/Develop/work$ perlb +rew use perl-5.8.9 A sub-shell is launched with perl-5.8.9 as the activated perl. Run 'ex +it' to finish it. pme@pme-notebook: ~/Develop/workpme@pme-notebook:~/Develop/work$ perl +pos2.pl F1.DAT int2 2147483648 int4 4294967296 int8 8589934592 int16 17179869184 File F1.DAT cached 1073741824 bytes in 9 seconds @ 119304647.111111 bs pme@pme-notebook: ~/Develop/workpme@pme-notebook:~/Develop/work$ perl +pos2.pl F1.DAT P@2 int2 2147483648 int4 4294967296 int8 8589934592 int16G17179869184 File F2.DAT cached -2147483648 bytes in 18 seconds @ -119304647.111111 + bs pme@pme-notebook: ~/Develop/workpme@pme-notebook:~/Develop/work$ exit exit pme@pme-notebook: ~/Develop/workpme@pme-notebook:~/Develop/work$ perlb +rew use perl-5.10.1 A sub-shell is launched with perl-5.10.1 as the activated perl. Run 'e +xit' to finish it. pme@pme-notebook: ~/Develop/workpme@pme-notebook:~/Develop/work$ perl +pos2.pl F2.DAT 1 int2 2147483648 int4 4294967296 int8 8589934592 int16 17179869184 File F1.DAT cached 1073741824 bytes in 8 seconds @ 134217728 bs pme@pme-notebook: ~/Develop/workpme@pme-notebook:~/Develop/work$ perl +pos2.pl F1.DAT P@2 int2 2147483648 int4 4294967296 int8 8589934592 int16 17179869184 File F2.DAT cached -2147483648 bytes in 18 seconds @ -119304647.111111 + bs pme@pme-notebook: ~/Develop/workpme@pme-notebook:~/Develop/work$ exit exit pme@pme-notebook: ~/Develop/workpme@pme-notebook:~/Develop/work$ perl +-v This is perl 5, version 20, subversion 2 (v5.20.2) built for i586-linu +x-gnu-thread-multi-64int (with 51 registered patches, see perl -V for more detail) Copyright 1987-2015, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using "man perl" or "perldoc perl". If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge. pme@pme-notebook: ~/Develop/workpme@pme-notebook:~/Develop/work$ perl +pos2.pl F1.DAT int2 2147483648 int4 4294967296 int8 8589934592 int16 17179869184 File F1.DAT cached 1073741824 bytes in 8 seconds @ 134217728 bs pme@pme-notebook: ~/Develop/workpme@pme-notebook:~/Develop/work$ perl +pos2.pl F1.DAT P@2 int2 2147483648 int4 4294967296 int8 8589934592 int16 17179869184 File F2.DAT cached 2147483648 bytes in 17 seconds @ 126322567.529412 b +s

In reply to Re: INDEX limits by pme
in thread INDEX limits by clivehumby

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.