Trying to squeeze that last drop out, eh? :)
This probably is not as efficient as it gets, but
you can always get rid of
temp vars by replacing one of
your for loops with a map:
foreach my $k (keys %columns) {
$columns{$k} = [ map { $columns{$k}->[$_] } @si ]
}
Ok, it looks nicer . . . let's check some benchmarks...
UPDATE!!!
use jmcnamara's solution - it's faster:
Benchmark: timing 30000 iterations of clintp, jeffa, jmcnamara...
clintp: 5 wallclock secs ( 4.29 usr + 0.10 sys = 4.39 CPU) @ 6833.71/s (n=30000)
jeffa: 3 wallclock secs ( 3.12 usr + 0.01 sys = 3.13 CPU) @ 9584.66/s (n=30000)
jmcnamara: 2 wallclock secs ( 2.18 usr + 0.01 sys = 2.19 CPU) @ 13698.63/s (n=30000)
jeffa
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.