Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: trunk/src/third_party/JSON/JSON-2.59/eg/bench_decode.pl

Issue 16539003: Revert 205057 "Add JSON.pm to third_party" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5 use Benchmark qw( cmpthese timethese );
6
7 our $VERSION = '1.00';
8
9 my $wanttime = $ARGV[1] || 5;
10
11 use JSON qw( -support_by_pp -no_export ); # for JSON::PP::Boolean inheritance
12 use JSON::PP ();
13 use JSON::XS ();
14 use utf8;
15
16 my $pp = JSON::PP->new->utf8;
17 my $xs = JSON::XS->new->utf8;
18
19 local $/;
20
21 my $json = <>;
22 my $perl = JSON::XS::decode_json $json;
23 my $result;
24
25
26 printf( "JSON::PP %s\n", JSON::PP->VERSION );
27 printf( "JSON::XS %s\n", JSON::XS->VERSION );
28
29
30 print "-----------------------------------\n";
31 print "->decode()\n";
32 print "-----------------------------------\n";
33
34 $result = timethese( -$wanttime,
35 {
36 'JSON::PP' => sub { $pp->decode( $json ) },
37 'JSON::XS' => sub { $xs->decode( $json ) },
38 },
39 'none'
40 );
41 cmpthese( $result );
42
43 print "-----------------------------------\n";
44
45
46 __END__
47
48 =pod
49
50 =head1 SYNOPSYS
51
52 bench_decode.pl json-file
53 # or
54 bench_decode.pl json-file minimum-time
55
56 =head1 DESCRIPTION
57
58 L<JSON::PP> and L<JSON::XS> decoding benchmark.
59
60 =head1 AUTHOR
61
62 makamaka
63
64 =head1 LISENCE
65
66 This library is free software; you can redistribute it and/or modify it
67 under the same terms as Perl itself.
68
69 =cut
70
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698