Clone::FastNatively copying Perl data structures | |
Download |
Clone::Fast Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Trevor Hall
- Publisher web site:
- http://search.cpan.org/~wazzuteke/
Clone::Fast Tags
Clone::Fast Description
Natively copying Perl data structures Clone::Fast is a Perl module designed as a very optimized version of Clone::More. By taking advantage of one of Clone::More's 'OPTIMIZATION_HACKS' as well as removing all the Pure Perl from the More.pm, I was able to gain a lot of speed out of the module. Essentially, though, the core of the module is exactly as that of Clone::More.You will see that by useing Benchmark::cmpthese, I ran a simple comparison between Storable::dclone, Clone::More::clone, and Clone::Fast::clone. You will (should) begin to see the reason why I loaded this module along side of Clone::More. Rate Storable Clone::More Clone::Fast Storable 7552/s -- -39% -59% Clone::More 12400/s 64% -- -33% Clone::Fast 18442/s 144% 49% --SYNOPSIS use strict; use warnings; use Clone::Fast qw( clone ); use Data::Dumper; # Though that may be the easiest thing to do, there # are also other options: # # use Clone::Fast; # While using Clone::Fast::clone # { # no strict 'refs'; # *clone = &Clone::Fast::clone; # } # # eval( "sub clone { Clone::Fast::clone }" ); my $original = bless( { 'a' => }, 'main' ); my $copy = clone( $original ); # Notice the original and copy are no longer the same, # although they look exactly the same print "Different memory segments " if ( $original ne $copy ); print "Same structure " if ( Dumper( $original ) eq Dumper( $copy ) ); Requirements: · Perl
Clone::Fast Related Software