Skip to content

Instantly share code, notes, and snippets.

@punytan
Created June 25, 2011 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save punytan/1046498 to your computer and use it in GitHub Desktop.
Save punytan/1046498 to your computer and use it in GitHub Desktop.
#!/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