Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^8: How to identify the package of a subroutine given only a reference to it

by drclaw (Acolyte)
on Feb 19, 2022 at 04:37 UTC ( #11141486=note: print w/replies, xml ) Need Help??


in reply to Re^7: How to identify the package of a subroutine given only a reference to it
in thread How to identify the package of a subroutine given only a reference to it

Thanks for the reply and benchmark insights. What OS are you running? Running your benchmark on my laptop with macOS 12.1 with perl 5.34 I get similar percentage differences to my original benchmark code:
macOS 12.1, your benchmark code: Rate methodic blessy direct methodic 16445180/s -- -27% -35% blessy 22503930/s 37% -- -11% direct 25252404/s 54% 12% -- macOS 12.1, rerun of my original benchmark code: Rate method blessed sub method 17857143/s -- -35% -44% blessed 27397260/s 53% -- -14% sub 31746032/s 78% 16% --
  • Comment on Re^8: How to identify the package of a subroutine given only a reference to it
  • Download Code

Replies are listed 'Best First'.
Re^9: How to identify the package of a subroutine given only a reference to it
by hv (Prior) on Feb 19, 2022 at 13:37 UTC

    My machine is running Ubuntu 18.04, but I would expect the OS to make little difference to such figures: the build options for perl would be far more important. For my 5.34 the relevant ones are -Dcc=gcc-9 -Doptimize="-g -O6" -Duse64bitall. In particular it would not surprise me if a -DDEBUGGING build slowed down operations on blessed coderefs relative to unblessed ones.

      Interesting. The macports perl 5.34 install I'm using has optimize='-O3'. On my Debian virtual machine with perlbrew perl 5.34 I have optimise='-O2'. I'll dig a little deeper/learn about more when I get a chance.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11141486]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2023-02-07 23:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (40 votes). Check out past polls.

    Notices?