Created
June 25, 2011 13:38
-
-
Save punytan/1046498 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Benchmark; | |
use JSON; | |
use LWP::UserAgent; | |
use Storable; | |
use MIME::Base64; | |
my $serializer = sub { MIME::Base64::encode_base64( Storable::nfreeze(shift) ) }; | |
my $deserializer = sub { Storable::thaw( MIME::Base64::decode_base64(shift) ) }; | |
my $structure = JSON::decode_json( | |
LWP::UserAgent->new->get('http://dist.schmorp.de/misc/json/long.json')->decoded_content); | |
timethis(-1, sub { | |
my $string = $serializer->($structure); | |
$deserializer->($string); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment