Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^5: Comparing and getting information from two large files and appending it in a new file

by graff (Chancellor)
on Apr 01, 2012 at 02:19 UTC ( #962820=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Comparing and getting information from two large files and appending it in a new file
in thread Comparing and getting information from two large files and appending it in a new file

To get one line of output for every line in your first input file, there's few changes.

... my %methrange; my %methhash; # this line had been further down in my prev.version, j +ust move it up ... if ( /^\s*Gm10/ ) { my ( $bgn, $end, $methcount ) = (split)[3,4,10]; $methrange{$bgn}{$end}{$_} = undef; $methhash{$_}(methcount} = $methcount; # moved up from below } ... for my $end ( keys %{$methrange{$bgn}} ) { if ( $position <= $end ) { for my $match ( keys %{$methrange{$bgn}{$end}} ) { $methhash{$match}{$class}++; # methcount was +moved from here } } } ...
As for the benchmark, you said that your OP version "took forever". Was "forever" more than an hour and a half? (Did my version yield any improvement at all?) Do you have specific constraints about how much time can be taken up by a single run? If not, I'd say focus more on making sure the output is correct, rather than how long it takes to produce the output.


Comment on Re^5: Comparing and getting information from two large files and appending it in a new file
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://962820]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (14)
As of 2014-09-18 18:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (120 votes), past polls