1s and 0s only? Any chance the lines are of the same size? Or actually even if they are not wouldn't it be better to store the data "directly" in binary instead of as a plain text file containin just 0s, 1s and newlines. Even if the lines were not the same length you might still store the data more efficiently. Storing the line length and using one bit instead of one byte for each 0/1. Not only you'll save lots of disk space and disk access, the comparisons will likewise be much quicker, with much less data to compare.

my $s1 = '10110101001010100011101101001010'; my $s2 = '10110101001010100011101101001011'; my $b1 = pack('b*', $s1); my $b2 = pack('b*', $s2); use Benchmark qw(timethese); timethese( 10000, { 'strings' => \&comp_strings, 'packs' => \&comp_packs, } ); sub comp_strings { for (1..1000) { $s1 eq $s1 and $s1 eq $s2 } } sub comp_packs { for (1..1000) { $b1 eq $b1 and $b1 eq $b2 } } __END__ Benchmark: timing 10000 iterations of packs, strings... packs: 4 wallclock secs ( 4.07 usr + 0.00 sys = 4.07 CPU) @ 246 +0.02/s (n=10000) strings: 5 wallclock secs ( 4.71 usr + 0.00 sys = 4.71 CPU) @ 212 +4.50/s (n=10000)

In reply to Re: What is a "big job" in the industry? by Jenda
in thread What is a "big job" in the industry? by punch_card_don

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.