in reply to Re: Re: Efficiency Question
in thread Efficiency Question

The general wisdom says that yes, method calls are slower than function calls. (In some cases DRAMATICALLY slower.) For a simple case though, lets find out:
use Benchmark; package Foo; sub bar { 1; } package main; timethese(1000000, { method => sub { Foo->bar(); }, func => sub { Foo::bar(); }, } );
Drumroll....
Benchmark: timing 1000000 iterations of func, method...
func: 1 wallclock secs ( 1.93 usr + 0.00 sys = 1.93 CPU) @ 518134.72/s (n=1000000)
method: 6 wallclock secs ( 4.95 usr + 0.00 sys = 4.95 CPU) @ 202020.20/s (n=1000000)
Yup! When in doubt, Benchmark.