Take home: every single method here is really, really fast. 24k calls per second is
not slow. You'd have to make some fairly radical mistakes in your API before that would ever matter!
If parameter parsing is really a bottleneck in your application then you're probably making too many subroutine calls! Much better than trying to tune parameter setup is to simply write methods that do work over sets of data. So instead of something like:
foreach my $data (@rows) {
$processor->do_one(data => $data);
}
Add support for:
$processor->do_all(rows => \@rows);
But the vast majority of applications out there are not CPU bound to begin with - they're I/O bound either talking to a network, the filesystem or a database. In any of those cases you'd be pretty unlikely to see parameter parsing show up on a profile - I use Params::Validate all the time and I've never seen it show up.
-sam
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.