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.36 by root, Wed May 23 22:07:43 2007 UTC vs.
Revision 1.37 by root, Wed Jun 6 14:52:49 2007 UTC

612It seems that JSON::XS is surprisingly fast, as shown in the following 612It seems that JSON::XS is surprisingly fast, as shown in the following
613tables. They have been generated with the help of the C<eg/bench> program 613tables. They have been generated with the help of the C<eg/bench> program
614in the JSON::XS distribution, to make it easy to compare on your own 614in the JSON::XS distribution, to make it easy to compare on your own
615system. 615system.
616 616
617First comes a comparison between various modules using a very short JSON 617First comes a comparison between various modules using a very short
618string: 618single-line JSON string:
619 619
620 {"method": "handleMessage", "params": ["user1", "we were just talking"], "id": null} 620 {"method": "handleMessage", "params": ["user1", "we were just talking"], \
621 "id": null, [1,11,234,-5,1e5,1e7, true, false]}
621 622
622It 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
623functional interface, while JSON::XS/2 uses the OO interface with 624functional interface, while JSON::XS/2 uses the OO interface with
624pretty-printing and hashkey sorting enabled). Higher is better: 625pretty-printing and hashkey sorting enabled). Higher is better:
625 626
627 -----------+------------+------------+
626 module | encode | decode | 628 module | encode | decode |
627 -----------|------------|------------| 629 -----------|------------|------------|
628 JSON | 11488.516 | 7823.035 | 630 JSON | 10597.029 | 5740.903 |
629 JSON::DWIW | 94708.054 | 129094.260 | 631 JSON::DWIW | 78251.940 | 98457.840 |
630 JSON::PC | 63884.157 | 128528.212 | 632 JSON::PC | 70611.178 | 92794.336 |
631 JSON::Syck | 34898.677 | 42096.911 | 633 JSON::Syck | 28767.517 | 38199.490 |
632 JSON::XS | 654027.064 | 396423.669 | 634 JSON::XS | 419430.400 | 265462.278 |
633 JSON::XS/2 | 371564.190 | 371725.613 | 635 JSON::XS/2 | 279620.267 | 265462.278 |
636 JSON::XS/3 | 388361.481 | 265462.278 |
637 Storable | 16294.887 | 16844.594 |
634 -----------+------------+------------+ 638 -----------+------------+------------+
635 639
636That is, JSON::XS is more than six times faster than JSON::DWIW on 640That is, JSON::XS is about five times faster than JSON::DWIW on encoding,
637encoding, more than three times faster on decoding, and about thirty times 641about three times faster on decoding, and about fourty times faster
638faster than JSON, even with pretty-printing and key sorting. 642than JSON, even with pretty-printing and key sorting. It also compares
643favourably to Storable for small amounts of data.
639 644
640Using a longer test string (roughly 18KB, generated from Yahoo! Locals 645Using a longer test string (roughly 18KB, generated from Yahoo! Locals
641search API (http://nanoref.com/yahooapis/mgPdGg): 646search API (http://nanoref.com/yahooapis/mgPdGg):
642 647
643 module | encode | decode | 648 module | encode | decode |
644 -----------|------------|------------| 649 -----------|------------|------------|
645 JSON | 273.023 | 44.674 | 650 JSON | 254.685 | 37.665 |
646 JSON::DWIW | 1089.383 | 1145.704 | 651 JSON::DWIW | 1014.244 | 1087.678 |
647 JSON::PC | 3097.419 | 2393.921 | 652 JSON::PC | 3602.116 | 2307.352 |
648 JSON::Syck | 514.060 | 843.053 | 653 JSON::Syck | 558.035 | 776.263 |
649 JSON::XS | 6479.668 | 3636.364 | 654 JSON::XS | 5747.196 | 3543.684 |
650 JSON::XS/2 | 3774.221 | 3599.124 | 655 JSON::XS/2 | 3968.121 | 3589.170 |
656 JSON::XS/3 | 6105.246 | 3561.134 |
657 Storable | 4456.337 | 5320.020 |
651 -----------+------------+------------+ 658 -----------+------------+------------+
652 659
653Again, JSON::XS leads by far. 660Again, JSON::XS leads by far.
654 661
655On large strings containing lots of high unicode characters, some modules 662On large strings containing lots of high unicode characters, some modules

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines