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.12 by root, Fri Mar 23 18:33:50 2007 UTC vs.
Revision 1.13 by root, Fri Mar 23 18:37:30 2007 UTC

507It seems that JSON::XS is surprisingly fast, as shown in the following 507It seems that JSON::XS is surprisingly fast, as shown in the following
508tables. They have been generated with the help of the C<eg/bench> program 508tables. They have been generated with the help of the C<eg/bench> program
509in the JSON::XS distribution, to make it easy to compare on your own 509in the JSON::XS distribution, to make it easy to compare on your own
510system. 510system.
511 511
512First is a comparison between various modules using a very simple JSON 512First comes a comparison between various modules using a very short JSON
513string, showing the number of encodes/decodes per second (JSON::XS is 513string (83 bytes), showing the number of encodes/decodes per second
514the functional interface, while JSON::XS/2 is the OO interface with 514(JSON::XS is the functional interface, while JSON::XS/2 is the OO
515pretty-printing and hashkey sorting enabled). 515interface with pretty-printing and hashkey sorting enabled). Higher is
516better:
516 517
517 module | encode | decode | 518 module | encode | decode |
518 -----------|------------|------------| 519 -----------|------------|------------|
519 JSON | 14006 | 6820 | 520 JSON | 14006 | 6820 |
520 JSON::DWIW | 200937 | 120386 | 521 JSON::DWIW | 200937 | 120386 |
525 -----------+------------+------------+ 526 -----------+------------+------------+
526 527
527That is, JSON::XS is 6 times faster than than JSON::DWIW and about 80 528That is, JSON::XS is 6 times faster than than JSON::DWIW and about 80
528times faster than JSON, even with pretty-printing and key sorting. 529times faster than JSON, even with pretty-printing and key sorting.
529 530
530Using a longer test string (roughly 8KB, generated from Yahoo! Locals 531Using a longer test string (roughly 18KB, generated from Yahoo! Locals
531search API (http://nanoref.com/yahooapis/mgPdGg): 532search API (http://nanoref.com/yahooapis/mgPdGg):
532 533
533 module | encode | decode | 534 module | encode | decode |
534 -----------|------------|------------| 535 -----------|------------|------------|
535 JSON | 673 | 38 | 536 JSON | 673 | 38 |
541 -----------+------------+------------+ 542 -----------+------------+------------+
542 543
543Again, JSON::XS leads by far in the encoding case, while still beating 544Again, JSON::XS leads by far in the encoding case, while still beating
544every other module in the decoding case. 545every other module in the decoding case.
545 546
547On large strings containing lots of unicode characters, some modules
548(such as JSON::PC) decode faster than JSON::XS, but the result will be
549broken due to missing unicode handling. Others refuse to decode or encode
550properly, so it was impossible to prepare a fair comparison table for that
551case.
552
546=head1 RESOURCE LIMITS 553=head1 RESOURCE LIMITS
547 554
548JSON::XS does not impose any limits on the size of JSON texts or Perl 555JSON::XS does not impose any limits on the size of JSON texts or Perl
549values they represent - if your machine can handle it, JSON::XS will 556values they represent - if your machine can handle it, JSON::XS will
550encode or decode it. Future versions might optionally impose structure 557encode or decode it. Future versions might optionally impose structure

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines