in reply to Re: Re: Efficiency Question
in thread Efficiency Question
Drumroll....use Benchmark; package Foo; sub bar { 1; } package main; timethese(1000000, { method => sub { Foo->bar(); }, func => sub { Foo::bar(); }, } );
Benchmark: timing 1000000 iterations of func, method...Yup! When in doubt, Benchmark.
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)
|
|---|