in reply to Re (tilly) 3: References
in thread References
Which gives me:#/usr/bin/perl -w use strict; use Benchmark; sub f { our %d; local *d = shift; $d{$_}=$_ foreach (0 .. 200); } sub b { my $d = shift; $$d{$_}=$_ foreach (0 .. 200); } my %c; timethese (100000, { 'f' => '&f(\%c)', 'b' => '&b(\%c)', });
I was expecting there to be at least some difference, since b has to dereference it every time.Benchmark: timing 100000 iterations of b, f... b: 83 wallclock secs (67.82 usr + 14.38 sys = 82.20 CPU) @ 12 +16.55/s (n=100000) f: 80 wallclock secs (65.86 usr + 13.95 sys = 79.81 CPU) @ 12 +52.98/s (n=100000)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (tilly) 5: References
by tilly (Archbishop) on Aug 20, 2001 at 15:58 UTC | |
|
Listen to Tilly ... he knows what's what!
by dragonchild (Archbishop) on Aug 20, 2001 at 16:35 UTC | |
by Cine (Friar) on Aug 20, 2001 at 17:46 UTC | |
by dragonchild (Archbishop) on Aug 20, 2001 at 18:09 UTC | |
by Cine (Friar) on Aug 20, 2001 at 18:19 UTC | |
by dragonchild (Archbishop) on Aug 20, 2001 at 18:37 UTC | |
|