From e39de35aca9998711a5c16d70ee4702e4e446123 Mon Sep 17 00:00:00 2001 From: Mark Pulford Date: Sat, 21 Jan 2012 23:02:08 +1030 Subject: Update performance documentation for clarity --- performance.txt | 68 +++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 24 deletions(-) diff --git a/performance.txt b/performance.txt index dd0872e..2fd5c7d 100644 --- a/performance.txt +++ b/performance.txt @@ -1,41 +1,58 @@ -JSON performance under Lua -========================== +JSON module performance comparison under Lua +============================================ +Mark Pulford +:revdate: Janurary 21, 2012 + +This performance comparison aims to provide a guide of relative +performance between several fast and popular JSON modules. + +The examples used in this comparison were mostly sourced from the +http://json.org[JSON website] and +http://tools.ietf.org/html/rfc4627[RFC 4627]. + +Performance will vary widely between platforms and data sets. These +results should only be used as an approximation. + Modules ------- -The following fast JSON libraries for Lua were tested: +The following JSON modules for Lua were tested: -[horizontal] http://chiselapp.com/user/dhkolf/repository/dkjson/[DKJSON 2.1]:: - - A Lua implementation with no dependencies - - Also supports LPeg to improve decode performance - - Tested with/without LPeg 10.2 -https://github.com/brimworks/lua-yajl[Lua YAJL 2.0]:: - - A C wrapper for the YAJL library - - Built with YAJL 2.0.4 -http://www.kyne.com.au/~mark/software/lua-cjson.php[Lua CSJON 2.0.0]:: - - A C implementation with no dependencies on other libraries - - Tested with/without internal floating point conversion routines + - Lua implementation with no dependencies on other libraries + - Supports LPeg to improve decode performance -The following Lua implementations were used for this comparison: +https://github.com/brimworks/lua-yajl[Lua YAJL 2.0]:: + - C wrapper for the YAJL library -- http://www.lua.org[Lua 5.1.4] -- http://www.luajit.org[LuaJIT 2.0.0-beta9] +http://www.kyne.com.au/~mark/software/lua-cjson.php[Lua CSJON 2.0.0]:: + - C implementation with no dependencies on other libraries Summary ------- -All libraries were built and used with their default settings. +All modules were built and tested as follows: -These results represent the number of JSON operations per second -sustained by each module. All the results have been normalised against -the pure Lua DKSJON implementation. +DKJSON:: Tested with/without LPeg 10.2. +Lua YAJL:: Tested with YAJL 2.0.4. +Lua CJSON:: Tested with Libc and internal floating point conversion + routines. + +The following Lua implementations were used for this comparison: + +- http://www.lua.org[Lua 5.1.4] (_Lua_) +- http://www.luajit.org[LuaJIT 2.0.0-beta9] (_JIT_) + +These results show the number of JSON operations per second sustained by +each module. All results have been normalised against the pure Lua +DKJSON implementation. .Decoding performance ............................................................................ - | DKJSON +LPeg | Lua YAJL | Lua CJSON +fpconv + | DKJSON | Lua YAJL | Lua CJSON + | No LPeg With LPeg | | Libc Internal | Lua JIT Lua JIT | Lua JIT | Lua JIT Lua JIT example1 | 1x 2x 2.6x 3.4x | 7.1x 10x | 14x 20x 14x 20x example2 | 1x 2.2x 2.9x 4.4x | 6.7x 9.9x | 14x 22x 14x 22x @@ -46,12 +63,14 @@ numbers | 1x 2.2x 2.3x 4x | 4.6x 5.5x | 8.9x 10x 13x 17x rfc-example1 | 1x 2.1x 2.8x 4.3x | 6.1x 8.1x | 13x 19x 14x 21x rfc-example2 | 1x 2.1x 3.1x 4.2x | 7.1x 9.2x | 15x 21x 17x 24x types | 1x 2.2x 2.6x 4.3x | 5.3x 7.4x | 12x 20x 13x 21x +-------------|-------------------------|------------|----------------------- = Average => | 1x 2.1x 2.7x 4.1x | 6.5x 9x | 13x 20x 14x 21x ............................................................................ .Encoding performance ............................................................................. - | DKJSON +LPeg | Lua YAJL | Lua CJSON +fpconv + | DKJSON | Lua YAJL | Lua CJSON + | No LPeg With LPeg | | Libc Internal | Lua JIT Lua JIT | Lua JIT | Lua JIT Lua JIT example1 | 1x 1.8x 0.97x 1.6x | 3.1x 5.2x | 23x 29x 23x 29x example2 | 1x 2x 0.97x 1.7x | 2.6x 4.3x | 22x 28x 22x 28x @@ -62,8 +81,9 @@ numbers | 1x 2.3x 1x 2.2x | 1.3x 1.9x | 3.8x 4.1x 4.2x 4.6x rfc-example1 | 1x 1.9x 0.97x 1.6x | 2.2x 3.2x | 8.5x 9.3x 11x 12x rfc-example2 | 1x 1.9x 0.98x 1.6x | 2.6x 3.9x | 10x 11x 17x 19x types | 1x 2.2x 0.97x 2x | 1.2x 1.9x | 11x 13x 12x 14x +-------------|-------------------------|------------|----------------------- = Average => | 1x 1.9x 0.98x 1.7x | 2.5x 3.9x | 14x 17x 16x 19x ............................................................................. -Performance can vary widely between platforms and data sets. These -results should only be used as a rough guide. + +// vi:ft=asciidoc tw=72: -- cgit v1.2.3-55-g6feb