Clear questions and runnable code
get the best and fastest answer
RFC extending Benchmark.pm to facilitate CODEHASHREFby LanX (Canon)
|on Nov 25, 2013 at 22:30 UTC||Need Help??|
I never liked the usage of the CODEHASHREF in Benchmark.
Often people start writing things like
which isn't very DRY and makes experimenting with optimizations really cumbersome! (I hate it, every new function name has to be repeated 3 times in different locations...)
see also Re: Best method to diff very large array efficiently for another examle.
My idea is to put all subs into a dedicated package (defaultname "CMP" or so) and to automatically filter necessary name and coderefs.
ATM I'm using a function pckg_subs() for this, not sure if it makes sense to extend the interface of cmpthese and timethese to directly accept a stash-ref like \%CMP::. ¹
Following a proof on concept, request for comments.
The idea code be extended with sub-attribute ':compare' or ':nocompare' to additionally mark functions which are supposed to be compared or not.
( addicted to the Perl Programming Language)
¹) is it possible to tell if a hashref belongs to a stash?
... well at least I could parse %main or pass the packagename directly =)