# Benchmark use warnings; use strict; use Benchmark qw(cmpthese); use Storable qw(freeze thaw); use JSON::XS; my $hashref = { one => 1, two => 2, three => 3, four => 4, five => 5 }; my @array = (1 .. 1000); cmpthese( -1, { 'storable-hashref' => sub { my $foo = thaw(freeze($hashref)); }, 'storable-arrayref' => sub { my $bar = thaw(freeze(\@array)); }, 'json-xs-hashref' => sub { my $foo = decode_json(encode_json($hashref)); }, 'json-xs-arrayref' => sub { my $bar = decode_json(encode_json(\@array)); }, } ); __END__