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.17 by root, Sat Mar 24 19:42:14 2007 UTC vs.
Revision 1.18 by root, Sat Mar 24 22:55:16 2007 UTC

527tables. They have been generated with the help of the C<eg/bench> program 527tables. They have been generated with the help of the C<eg/bench> program
528in the JSON::XS distribution, to make it easy to compare on your own 528in the JSON::XS distribution, to make it easy to compare on your own
529system. 529system.
530 530
531First comes a comparison between various modules using a very short JSON 531First comes a comparison between various modules using a very short JSON
532string (83 bytes), showing the number of encodes/decodes per second 532string:
533(JSON::XS is the functional interface, while JSON::XS/2 is the OO 533
534 {"method": "handleMessage", "params": ["user1", "we were just talking"], "id": null}
535
536It shows the number of encodes/decodes per second (JSON::XS uses the
537functional interface, while JSON::XS/2 uses the OO interface with
534interface with pretty-printing and hashkey sorting enabled). Higher is 538pretty-printing and hashkey sorting enabled). Higher is better:
535better:
536 539
537 module | encode | decode | 540 module | encode | decode |
538 -----------|------------|------------| 541 -----------|------------|------------|
539 JSON | 14006 | 6820 | 542 JSON | 11488.516 | 7823.035 |
540 JSON::DWIW | 200937 | 120386 | 543 JSON::DWIW | 94708.054 | 129094.260 |
541 JSON::PC | 85065 | 129366 | 544 JSON::PC | 63884.157 | 128528.212 |
542 JSON::Syck | 59898 | 44232 | 545 JSON::Syck | 34898.677 | 42096.911 |
543 JSON::XS | 1171478 | 342435 | 546 JSON::XS | 654027.064 | 396423.669 |
544 JSON::XS/2 | 730760 | 328714 | 547 JSON::XS/2 | 371564.190 | 371725.613 |
545 -----------+------------+------------+ 548 -----------+------------+------------+
546 549
547That is, JSON::XS is 6 times faster than than JSON::DWIW and about 80 550That is, JSON::XS is more than six times faster than JSON::DWIW on
551encoding, more than three times faster on decoding, and about thirty times
548times faster than JSON, even with pretty-printing and key sorting. 552faster than JSON, even with pretty-printing and key sorting.
549 553
550Using a longer test string (roughly 18KB, generated from Yahoo! Locals 554Using a longer test string (roughly 18KB, generated from Yahoo! Locals
551search API (http://nanoref.com/yahooapis/mgPdGg): 555search API (http://nanoref.com/yahooapis/mgPdGg):
552 556
553 module | encode | decode | 557 module | encode | decode |
554 -----------|------------|------------| 558 -----------|------------|------------|
555 JSON | 673 | 38 | 559 JSON | 273.023 | 44.674 |
556 JSON::DWIW | 5271 | 770 | 560 JSON::DWIW | 1089.383 | 1145.704 |
557 JSON::PC | 9901 | 2491 | 561 JSON::PC | 3097.419 | 2393.921 |
558 JSON::Syck | 2360 | 786 | 562 JSON::Syck | 514.060 | 843.053 |
559 JSON::XS | 37398 | 3202 | 563 JSON::XS | 6479.668 | 3636.364 |
560 JSON::XS/2 | 13765 | 3153 | 564 JSON::XS/2 | 3774.221 | 3599.124 |
561 -----------+------------+------------+ 565 -----------+------------+------------+
562 566
563Again, JSON::XS leads by far in the encoding case, while still beating 567Again, JSON::XS leads by far.
564every other module in the decoding case.
565 568
566On large strings containing lots of unicode characters, some modules 569On large strings containing lots of high unicode characters, some modules
567(such as JSON::PC) decode faster than JSON::XS, but the result will be 570(such as JSON::PC) seem to decode faster than JSON::XS, but the result
568broken due to missing unicode handling. Others refuse to decode or encode 571will be broken due to missing (or wrong) unicode handling. Others refuse
569properly, so it was impossible to prepare a fair comparison table for that 572to decode or encode properly, so it was impossible to prepare a fair
570case. 573comparison table for that case.
571 574
572=head1 RESOURCE LIMITS 575=head1 RESOURCE LIMITS
573 576
574JSON::XS does not impose any limits on the size of JSON texts or Perl 577JSON::XS does not impose any limits on the size of JSON texts or Perl
575values they represent - if your machine can handle it, JSON::XS will 578values they represent - if your machine can handle it, JSON::XS will

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines