in reply to Perl script speed

This code has a complexity of O(n^2) at least since you have some while statements in there. Don't nest loops and you might go faster. I would suggest multiple passes if necessary over nesting loops.

Replies are listed 'Best First'.
Re^2: Perl script speed
by GrandFather (Saint) on May 30, 2014 at 12:53 UTC

    The "nested while loops" are a non-issue in terms of the overall performance of the code. They are a really inefficient way of emptying arrays, but in the context of the database I/O they are totally insignificant. The code complexity is O(n).

    There are nested for loops too which are more interesting, but they effectively add a fixed computational load per line so again the have no effect on the complexity.

    Perl is the programming world's equivalent of English