in reply to Can you help profile this?
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; 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; } }
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...
|
|---|