Howdy there,
I am having an issue dereferencing a series of arrays (which are all in this case diifferent files taken in line by line) inside a subroutine. I do this for several arrays sequentially by applying a subroutine several times. The third array I dereference is rather large (constructed from a 100 Mb txt file), but only 25X as large as the next largest file. Unfortunately, this operation seems to take ~460 seconds, whereas the same operation for any other file takes at most between 1-2 seconds, as can be seen by my results (posted below). I have to do this many times repeatedly throughout my code and cannot really afford this huge lag time. Is there any way I can speed this up? Is there a reason why this is hanging? It should be noted that while it is hanging that the memory usage for perl slowly crawls from ~500,000k to ~700,000k. Thanks for your help!
Relevant code:
sub genLookupTable{ #begin subroutine genLookupTable #ArrayRefs is a global variable wherein the references to the arrays o +f interest are stored my $lengRefs = @ArrayRefs for(my $i = 0; $i<$lengRefs; $i++){ print time()." is the time before\n"; my @lines = @{$ArrayRefs[$i]}; print time()." is the time after\n"; my $why = @lines; print " The length of lines for $i is $why\n"; …
Relevant Results:
C:\Perl\bin>perl newIntermediate2.pl
The time is now 1244797376
files are opening...
files have opened and been put into arrays and those arrays have been made into references and put into an array...
The time is now 1244797384
Those arrays are being processed...
I am now in the subroutine.
1244797425 is the time before dereferencing array 1
1244797425 is the time after dereferencing array 1
The length of lines for 0 is 87544
1244797426 is the time before dereferencing array 2
1244797426 is the time after dereferencing array 2
The length of lines for 1 is 21573
1244797426 is the time before dereferencing array 3
1244797892 is the time after dereferencing array 3
The length of lines for 2 is 2250393
1244797893 is the time before dereferencing array 4
1244797893 is the time after dereferencing array 4
The length of lines for 3 is 12329
1244797893 is the time before dereferencing array 5
1244797893 is the time after dereferencing array 5
The length of lines for 4 is 83274
1244797893 is the time before dereferencing array 6
1244797893 is the time after dereferencing array 6
The length of lines for 5 is 66514
1244797893 is the time before dereferencing array 7
1244797893 is the time after dereferencing array 7
The length of lines for 6 is 7998
1244797893 is the time before dereferencing array 8
1244797893 is the time after dereferencing array 8
The length of lines for 7 is 2453
In reply to Slow Dereferencing and Not Sure Why by deequeue
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |