in reply to Performance improvement in perl scripts
The “80/20 rule” applies all over the place when it comes to talking about computers: such as, “80% of the time is spent in 20% of the code,” or, “80% of the code is [almost] never used anyway,” and so on.
Having decided upon a reasonably efficient algorithm, for what the program actually needs to do (and no more...), measure to see the particular spots where the program is running both frequently and slowly.
Human-perceptible slowdowns are almost always going to involve input/output: either inefficient operations against actual files, or, perhaps more likely, wasteful use of memory which causes thrashing.
Performance improvements are usually trade-offs: you get something, you pay something. That decision will be yours.
Finally, there is this august maxim from the venerable Elements of Programming Style: don’t “diddle” the code to make it faster .. find a better algorithm. I suggest that this notion should lead you very frequently to CPAN; to the assumption that a “better algorithm” probably exists, and that a CPAN author probably found it.
actually| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Performance improvement in perl scripts
by JavaFan (Canon) on Apr 26, 2012 at 12:40 UTC | |
by BillKSmith (Monsignor) on Apr 26, 2012 at 14:35 UTC | |
by JavaFan (Canon) on Apr 26, 2012 at 14:45 UTC |