Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Some more variations for you to include in the mix...

    Params::Util::_INSTANCE has long done Scalar::Util::blessed($foo) and $foo->isa('bar'), I'd be interested to see how much overhead the extra function call adds.

    Also, try substituting UNIVERSAL::can($foo, 'can') for blessed($foo)
    • (note, they may not be faster, but I'd like to see comparative speeds)
    • So you want a fully qualified call to blessed instead of my importing it? Or did you miss that I had called blessed? UNIVERSAL::can('isa') is interestesting, but I'm sure that won't be much faster. I've added both of those (the fully qualified Scalar::Util::blessed() is called 'fqblessed', of course).

      Benchmark: timing 200000 iterations of blessed, can, eval, fqblessed, stringify, universal, unpack...
         blessed:  1 wallclock secs ( 0.86 usr +  0.00 sys =  0.86 CPU) @ 232558.14/s

      • No, I meant you should include the overhead of doing it the fastest way (which Params::Util does) but with an extra function call of calling Params::Util::_INSTANCE itself.