in reply to Re^2: Dump, Dup or Copy an object
in thread Dump, Dup or Copy an object
The reason because Scalar::Util::Clone is commented out is that I couldn't make it compile nor did I find a ppd for it. Maybe someone else can step in?use Benchmark qw(timethese); use Clone; use Storable; #use Scalar::Util::Clone; my $struct = { 'foo' => 'bar', 'move' => 'zig', bar => [1, 2, 3] }; timethese ( 500000, { 'Clone' => sub { my $s = Clone::clone($struct) + }, #'Scalar::Util::Clone' => sub { my $s = Scalar::Util::Clone::c +lone ($struct) }, 'Storable' => sub { my $s = Storable::dclone ($stru +ct) } } ); #Benchmark: timing 500000 iterations of Clone, Storable... # Clone: 3 wallclock secs ( 4.28 usr + 0.00 sys = 4.28 CPU) @ 1169 +04.37/s (n=500000) # Storable: 74 wallclock secs (69.62 usr + 0.03 sys = 69.65 CPU) @ 7 +178.65/s (n=500000)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Dump, Dup or Copy an object
by turo (Friar) on Feb 22, 2006 at 16:09 UTC |