aboutsummaryrefslogtreecommitdiff
path: root/performance.adoc
diff options
context:
space:
mode:
Diffstat (limited to 'performance.adoc')
-rw-r--r--performance.adoc89
1 files changed, 89 insertions, 0 deletions
diff --git a/performance.adoc b/performance.adoc
new file mode 100644
index 0000000..a36412d
--- /dev/null
+++ b/performance.adoc
@@ -0,0 +1,89 @@
1JSON module performance comparison under Lua
2============================================
3Mark Pulford <mark@kyne.com.au>
4:revdate: January 22, 2012
5
6This performance comparison aims to provide a guide of relative
7performance between several fast and popular JSON modules.
8
9The examples used in this comparison were mostly sourced from the
10http://json.org[JSON website] and
11http://tools.ietf.org/html/rfc4627[RFC 4627].
12
13Performance will vary widely between platforms and data sets. These
14results should only be used as an approximation.
15
16
17Modules
18-------
19
20The following JSON modules for Lua were tested:
21
22http://chiselapp.com/user/dhkolf/repository/dkjson/[DKJSON 2.1]::
23 - Lua implementation with no dependencies on other libraries
24 - Supports LPeg to improve decode performance
25
26https://github.com/brimworks/lua-yajl[Lua YAJL 2.0]::
27 - C wrapper for the YAJL library
28
29http://www.kyne.com.au/%7Emark/software/lua-cjson.php[Lua CJSON 2.0.0]::
30 - C implementation with no dependencies on other libraries
31
32
33Summary
34-------
35
36All modules were built and tested as follows:
37
38DKJSON:: Tested with/without LPeg 10.2.
39Lua YAJL:: Tested with YAJL 2.0.4.
40Lua CJSON:: Tested with Libc and internal floating point conversion
41 routines.
42
43The following Lua implementations were used for this comparison:
44
45- http://www.lua.org[Lua 5.1.4] (_Lua_)
46- http://www.luajit.org[LuaJIT 2.0.0-beta9] (_JIT_)
47
48These results show the number of JSON operations per second sustained by
49each module. All results have been normalised against the pure Lua
50DKJSON implementation.
51
52.Decoding performance
53............................................................................
54 | DKJSON | Lua YAJL | Lua CJSON
55 | No LPeg With LPeg | | Libc Internal
56 | Lua JIT Lua JIT | Lua JIT | Lua JIT Lua JIT
57example1 | 1x 2x 2.6x 3.4x | 7.1x 10x | 14x 20x 14x 20x
58example2 | 1x 2.2x 2.9x 4.4x | 6.7x 9.9x | 14x 22x 14x 22x
59example3 | 1x 2.1x 3x 4.3x | 6.9x 9.3x | 14x 21x 15x 22x
60example4 | 1x 2x 2.5x 3.7x | 7.3x 10x | 12x 19x 12x 20x
61example5 | 1x 2.2x 3x 4.5x | 7.8x 11x | 16x 24x 16x 24x
62numbers | 1x 2.2x 2.3x 4x | 4.6x 5.5x | 8.9x 10x 13x 17x
63rfc-example1 | 1x 2.1x 2.8x 4.3x | 6.1x 8.1x | 13x 19x 14x 21x
64rfc-example2 | 1x 2.1x 3.1x 4.2x | 7.1x 9.2x | 15x 21x 17x 24x
65types | 1x 2.2x 2.6x 4.3x | 5.3x 7.4x | 12x 20x 13x 21x
66-------------|-------------------------|------------|-----------------------
67= Average => | 1x 2.1x 2.7x 4.1x | 6.5x 9x | 13x 20x 14x 21x
68............................................................................
69
70.Encoding performance
71.............................................................................
72 | DKJSON | Lua YAJL | Lua CJSON
73 | No LPeg With LPeg | | Libc Internal
74 | Lua JIT Lua JIT | Lua JIT | Lua JIT Lua JIT
75example1 | 1x 1.8x 0.97x 1.6x | 3.1x 5.2x | 23x 29x 23x 29x
76example2 | 1x 2x 0.97x 1.7x | 2.6x 4.3x | 22x 28x 22x 28x
77example3 | 1x 1.9x 0.98x 1.6x | 2.8x 4.3x | 13x 15x 16x 18x
78example4 | 1x 1.7x 0.96x 1.3x | 3.9x 6.1x | 15x 19x 17x 21x
79example5 | 1x 2x 0.98x 1.7x | 2.7x 4.5x | 20x 23x 20x 23x
80numbers | 1x 2.3x 1x 2.2x | 1.3x 1.9x | 3.8x 4.1x 4.2x 4.6x
81rfc-example1 | 1x 1.9x 0.97x 1.6x | 2.2x 3.2x | 8.5x 9.3x 11x 12x
82rfc-example2 | 1x 1.9x 0.98x 1.6x | 2.6x 3.9x | 10x 11x 17x 19x
83types | 1x 2.2x 0.97x 2x | 1.2x 1.9x | 11x 13x 12x 14x
84-------------|-------------------------|------------|-----------------------
85= Average => | 1x 1.9x 0.98x 1.7x | 2.5x 3.9x | 14x 17x 16x 19x
86.............................................................................
87
88
89// vi:ft=asciidoc tw=72: