in reply to Re: How does the while works in case of Filehandle when reading a gigantic file in Perl
in thread How does the while works in case of Filehandle when reading a gigantic file in Perl
/me nods ...
A very compelling explanation for “exponentially slower” would be that this program is, indeed, reading the entire file into memory and trying to process it that way. The process’s working set tries to become larger than the file itself, and the memory-manager of the system can&rquo;t accommodate that, and what happens is that the system starts “thrashing.” If you graph the performance-curve of that, it is “exponential.”
If a file is indeed being read linearly, without stuffing it all into memory, then the completion time profile ought to be linear: the “lines processed per millisecond” should be more or less constant, and the working-set size of the process (as seen by top or somesuch) should not vary according to the size of the file being processed. If the file is twice as big, it should take about twice as long, all other things being equal. So, if that is not what is seen to be happening, “a great big slurp” is almost certain to be the explanation, and the good news is that it should be quite easy to fix.
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How does the while works in case of Filehandle when reading a gigantic file in Perl
by Anonymous Monk on Jan 30, 2015 at 15:22 UTC | |
by CountZero (Bishop) on Jan 30, 2015 at 20:48 UTC | |
by locked_user sundialsvc4 (Abbot) on Jan 30, 2015 at 22:14 UTC |