Hello Everyone,
I am again in need of help to make this script a little faster. It currently takes 20 minutes to run, and i would like to make it a little bit faster. Here is some code
foreach $key(@totalkeys){
$NETID = $totalnetname{$key};
@ECLDATA = grep /^$NETID\|$datecompare/, @ECL_STAT;
@ECL_STAT = grep !/^$NETID\|/, @ECL_STAT;
@CELDATA = grep /^$NETID\|$datecompare/, @CEL_STAT;
@CEL_STAT = grep !/^$NETID\|/, @CEL_STAT;
# a lot more code................
}
Basically, the arrays ECL_STAT and CEL_STAT are searched 1,200 times, using a different NETID each time. The arrays are around 60,000 lines each, and each searchstring yeilds about 50 entries. Basically, what I would like to do is, as the array is searched, and the results are stored in the corresponding array (ECLDATA and CELDATA), i would like thos entries to be removed. The way i am doing it here, didnt seem to make the script run any faster, infact it seemed to slow down. I assume that
because the script does 2 searches now, instead of just one per array. Is there a way to , in one simple faster step, as the data is found, to delete it from the main array??
Thanks Everyone
Also: This is not homework :) hehe i know it might be interpreted as it, but its not :)
Dipul
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.