The immediate thing I notice is that @Attn is way larger than it needs to be. It looks like you determine a value for each element in every 14-element slice of @in. Instead of storing that value 14 times, just store it once, and have each element of the 14-element slice of @in look to that one element. This is untested, but...
for (my $i = 0; $i < @in; $i += 14) { my $num = $in[$in[$i+12] * $MaxAgc0; push @Attn, $num / $in[$i+10]; } for (my $i = 0; $i < @in; $i += 14) { foreach (2 .. 9) { push @powers, ($in[$i + $_] - $Attn[$i/14]) / 100; } }
Actually, now that I wrote that out, I'm thinking you don't even need to build @Attn (again, untested):
for (my $i = 0; $i < @in; $i += 14) { my $num = $in[$in[$i+12] * $MaxAgc0; $num = $num / $in[$i+10]; foreach (2 .. 9) { push @powers, ($in[$i + $_] - $num) / 100; } }

EDIT:

All the above code may be wrong. I misread what the j-loop was doing in the original code; I had thought you were comparing to a slice of @in for some reason, but that's apparently not the case. I'm confused though...does the input data provide some sort of meta-information that you're reading in at every 14th element?

My initial thought was that @Attn and @in were meant to be parallel arrays, but with the limit of the j-loop being defined that way, this would probably not be true...


In reply to Re: Can you help profile this? by Riales
in thread Can you help profile this? by Fighter2

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.