ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/JSON-XS/XS.pm
(Generate patch)

Comparing JSON-XS/XS.pm (file contents):
Revision 1.37 by root, Wed Jun 6 14:52:49 2007 UTC vs.
Revision 1.38 by root, Wed Jun 6 18:16:52 2007 UTC

86package JSON::XS; 86package JSON::XS;
87 87
88use strict; 88use strict;
89 89
90BEGIN { 90BEGIN {
91 our $VERSION = '1.22'; 91 our $VERSION = '1.23';
92 our @ISA = qw(Exporter); 92 our @ISA = qw(Exporter);
93 93
94 our @EXPORT = qw(to_json from_json objToJson jsonToObj); 94 our @EXPORT = qw(to_json from_json objToJson jsonToObj);
95 require Exporter; 95 require Exporter;
96 96
616 616
617First comes a comparison between various modules using a very short 617First comes a comparison between various modules using a very short
618single-line JSON string: 618single-line JSON string:
619 619
620 {"method": "handleMessage", "params": ["user1", "we were just talking"], \ 620 {"method": "handleMessage", "params": ["user1", "we were just talking"], \
621 "id": null, [1,11,234,-5,1e5,1e7, true, false]} 621 "id": null, "array":[1,11,234,-5,1e5,1e7, true, false]}
622 622
623It shows the number of encodes/decodes per second (JSON::XS uses the 623It shows the number of encodes/decodes per second (JSON::XS uses the
624functional interface, while JSON::XS/2 uses the OO interface with 624functional interface, while JSON::XS/2 uses the OO interface with
625pretty-printing and hashkey sorting enabled). Higher is better: 625pretty-printing and hashkey sorting enabled). Higher is better:
626 626
627 -----------+------------+------------+
628 module | encode | decode | 627 module | encode | decode |
629 -----------|------------|------------| 628 -----------|------------|------------|
630 JSON | 10597.029 | 5740.903 | 629 JSON | 7645.468 | 4208.613 |
631 JSON::DWIW | 78251.940 | 98457.840 | 630 JSON::DWIW | 68534.379 | 79437.576 |
632 JSON::PC | 70611.178 | 92794.336 | 631 JSON::PC | 65948.176 | 78251.940 |
633 JSON::Syck | 28767.517 | 38199.490 | 632 JSON::Syck | 23379.621 | 28416.694 |
634 JSON::XS | 419430.400 | 265462.278 |
635 JSON::XS/2 | 279620.267 | 265462.278 |
636 JSON::XS/3 | 388361.481 | 265462.278 | 633 JSON::XS | 388361.481 | 199728.762 |
637 Storable | 16294.887 | 16844.594 | 634 JSON::XS/2 | 218453.333 | 192399.266 |
635 JSON::XS/3 | 338250.323 | 192399.266 |
636 Storable | 15732.573 | 28571.553 |
638 -----------+------------+------------+ 637 -----------+------------+------------+
639 638
640That is, JSON::XS is about five times faster than JSON::DWIW on encoding, 639That is, JSON::XS is about five times faster than JSON::DWIW on encoding,
641about three times faster on decoding, and about fourty times faster 640about three times faster on decoding, and over fourty times faster
642than JSON, even with pretty-printing and key sorting. It also compares 641than JSON, even with pretty-printing and key sorting. It also compares
643favourably to Storable for small amounts of data. 642favourably to Storable for small amounts of data.
644 643
645Using a longer test string (roughly 18KB, generated from Yahoo! Locals 644Using a longer test string (roughly 18KB, generated from Yahoo! Locals
646search API (http://nanoref.com/yahooapis/mgPdGg): 645search API (http://nanoref.com/yahooapis/mgPdGg):

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines