performance.txt 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. JSON Performance Comparison under Lua
  2. -------------------------------------
  3. The following JSON packages for Lua were tested:
  4. - DKJSON 1.0: One of the fastest pure Lua JSON implementations.
  5. - LuaJSON 1.0: A mixed Lua/C JSON implementation using LPeg.
  6. - Lua YAJL 2.0: A Lua wrapper for the YAJL JSON library.
  7. - CSJON 1.0.2: Pure C.
  8. LuaJSON 1.2.2 appeared to be slower during initial testing, so 1.0 was
  9. used instead.
  10. The following Lua implementations were used for this comparison:
  11. - Lua 5.1.4
  12. - LuaJIT 2.0.0-beta7
  13. The example JSON files used were taken from http://json.org/ and
  14. RFC 4627.
  15. DKJSON 1.0 LuaJSON 1.0 LuaYAJL 2.0 CJSON 1.0.2
  16. == Decoding == Lua LuaJIT Lua LuaJIT Lua LuaJIT Lua LuaJIT
  17. example1 1.0x 2.0x 3.4x 4.0x 7.1x 10.1x 13.2x 19.4x
  18. example2 1.0x 2.1x 3.5x 4.5x 6.6x 9.8x 12.7x 20.0x
  19. example3 1.0x 2.0x 3.9x 4.7x 7.0x 9.4x 13.2x 19.3x
  20. example4 1.0x 1.9x 3.7x 4.4x 7.4x 10.6x 11.8x 18.0x
  21. example5 1.0x 2.1x 4.0x 4.7x 7.7x 11.4x 14.7x 22.3x
  22. numbers 1.0x 2.1x 2.1x 3.4x 4.6x 5.7x 8.6x 10.4x
  23. rfc-example1 1.0x 2.0x 3.2x 4.2x 5.8x 8.2x 11.8x 17.7x
  24. rfc-example2 1.0x 2.0x 3.6x 4.5x 7.0x 9.3x 14.5x 20.5x
  25. types 1.0x 2.1x 2.3x 3.5x 4.9x 7.6x 10.7x 17.2x
  26. == Average ==> 1.0x 2.0x 3.3x 4.2x 6.4x 9.1x 12.4x 18.3x
  27. == Encoding ==
  28. example1 1.0x 1.9x 0.6x 1.4x 3.5x 5.6x 23.1x 29.1x
  29. example2 1.0x 2.0x 0.5x 1.2x 3.0x 4.9x 23.4x 28.5x
  30. example3 1.0x 1.8x 0.6x 1.3x 3.0x 4.7x 13.3x 14.9x
  31. example4 1.0x 1.7x 0.7x 1.5x 4.2x 6.6x 15.4x 18.5x
  32. example5 1.0x 2.0x 0.6x 1.4x 3.4x 5.5x 22.7x 25.5x
  33. numbers 1.0x 2.4x 0.4x 0.9x 1.4x 2.1x 4.3x 4.6x
  34. rfc-example1 1.0x 1.9x 0.5x 1.2x 2.3x 3.6x 8.8x 9.6x
  35. rfc-example2 1.0x 1.9x 0.6x 1.3x 2.8x 4.3x 10.7x 10.7x
  36. types 1.0x 2.4x 0.3x 0.7x 1.4x 2.3x 11.7x 11.3x
  37. == Average ==> 1.0x 2.0x 0.6x 1.2x 2.8x 4.4x 14.8x 17.0x
  38. Number conversion is a relatively expensive operation. Number heavy
  39. JSON will show less performance difference between libraries.
  40. Performance can vary widely between platforms and data sets. These
  41. results should only be considered as a rough guide.