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
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Find the invariant (Score:1)
So try to find (or establish) the boundary where $var is always known to not be undef. Test it once there, and not in an inner loop. If possible, it may very well not be.
If that's not feasible, how about introducing null objects instead of undef values?
Re: squeezing out performance. Do you need the overhead of calling blessed? If $var contains a string instead of an object, $var->isa is going to work as a class method anyway, right? (and return fa
Re: (Score:2)
Re: (Score:1)
Also anything else that needs custom isa values, asa.pm, Class::Adapter, Class::Decorator, and others.
The only legitimate use for the UNIVERSAL functions directly that I'm aware of is the UNIVERSAL::can($foo, 'can') which is a highly back-compatible method for testing "is $foo an object".
Re:Find the invariant (Score:2)
UNIVERSAL::can($foo, 'can')which is a highly back-compatible method for testing "is $foo an object".No joke, I extended the original benchmarks with
and got these results:Well... My code definitely is the fastest. I am surprised at the speed difference between 'can' and 'isa'. 'can' is the winner!
Reply to This
Parent