in reply to Perl scripts slowing down towards end of file processing

Well, if you are running on a Windoze box, you could be slamming the memory ... we'd have to see the code to say for sure, though. If that is the case, you may be forcing 'doze to use virtual memory (you know, hard disk) for data structure storage. On a fragmented drive, that incurs an even greater performance penalty of course.

Can you update us with details about the platform, data structures, etc.?

Update from HZ: It has been noted to me (thank you tye) that other systems can also penalize you for slamming memory. In any case, we need more details to help you. Please, sir, can we see your code?
  • Comment on Re: Perl scripts slowing down towards end of file processing

Replies are listed 'Best First'.
Re: Re: Perl scripts slowing down towards end of file processing
by JPaul (Hermit) on Jul 14, 2001 at 00:12 UTC
    Script is running on a linux machine running perl 5.6.0
    There are no complex 'data structures' to speak of, except a bunch of vars containing integers for counting, and a few with the text removed from the statement file using substr().
    None of the text removed is over 30 bytes in length.
    Each page is separated into an array (@page = split(/\n/, $page_contents)), the @page array contains 65 elements of less than 85 bytes (changes per page), and is overwritten each time we split() a new page.

    Did I miss anything?
    JP -- Alexander Widdlemouse undid his bellybutton and his bum dropped off --

      That behavior does sound like what happens when you start using too much memory (non-linear reduction in performance). So you should check the memory consumption of the process during different points in the run (for example, via the "ps" command).

      Some file systems can also get much slower when they get nearly full so that is another possibility to check.

      Another possiblity is that your total (virtual) memory consumption hasn't grown too high but that you are jumping around too much in memory such that your "working set" is too large to fit in the available RAM.

      But, yes, we are all just guessing.

      Nothing in your description rings alarms bells to me about where the memory usage would be growing.

              - tye (but my friends call me "Tye")