in reply to Re^2: named sub, subref and magic goto speed
in thread named sub, subref and magic goto speed
I'm not sure what you're asking, but goto &$ref is no faster than foo(), which is in line with the linked node.
use strict; use warnings; use Benchmark qw( cmpthese ); sub foo { @_ } my $ref = \&foo; cmpthese(-2, { refcall => sub { @_=(1); $ref->(@_) }, named => sub { @_=(1); foo(@_) }, g_scalar => sub { @_=(1); goto $ref }, g_amp => sub { @_=(1); goto &$ref }, });
outputs
Rate named refcall g_amp g_scalar named 811837/s -- -1% -3% -26% refcall 820126/s 1% -- -2% -25% g_amp 834174/s 3% 2% -- -24% g_scalar 1099304/s 35% 34% 32% --
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: named sub, subref and magic goto speed
by Limbic~Region (Chancellor) on Dec 14, 2006 at 16:50 UTC | |
by ikegami (Patriarch) on Dec 14, 2006 at 16:54 UTC | |
by Limbic~Region (Chancellor) on Dec 14, 2006 at 17:01 UTC | |
by jdporter (Paladin) on Dec 14, 2006 at 17:15 UTC | |
by Limbic~Region (Chancellor) on Dec 14, 2006 at 17:18 UTC | |
by Limbic~Region (Chancellor) on Dec 14, 2006 at 19:14 UTC |