Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re^2: Faster indexing an arrayby wollmers (Scribe) |
on Sep 19, 2014 at 22:09 UTC ( [id://1101302]=note: print w/replies, xml ) | Need Help?? |
Thanks a lot. Davidos solution is faster than mine, and LanX' and CountZeros is the fastest. For some reason Devel::NYTProf gives better results for C-style loops over 'for my $i (...)'. The hashref is a relict from having this part in an sub, then refactored down, then inlined, now 1-lined. See here the same logic in Algorithm::Diff:
Having an arrayref comes from the two input-parameters, sequences X, Y or sometimes also called A, B in the descriptions of diff/LCS/align-algorithms. Helmut Wollmersdorfer
In Section
Seekers of Perl Wisdom
|
|