Out of curiosity i benchmarked it and got the following results:
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)
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?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.