diff options
author | Mark Pulford <mark@kyne.com.au> | 2012-01-21 23:02:08 +1030 |
---|---|---|
committer | Mark Pulford <mark@kyne.com.au> | 2012-03-04 18:54:35 +1030 |
commit | e39de35aca9998711a5c16d70ee4702e4e446123 (patch) | |
tree | 93ffc77d787439ab18827906d7a60cb9c1d43903 | |
parent | f1eda76cf5b8923d7e3cec43e89f2aa60c44c008 (diff) | |
download | lua-cjson-e39de35aca9998711a5c16d70ee4702e4e446123.tar.gz lua-cjson-e39de35aca9998711a5c16d70ee4702e4e446123.tar.bz2 lua-cjson-e39de35aca9998711a5c16d70ee4702e4e446123.zip |
Update performance documentation for clarity
-rw-r--r-- | performance.txt | 68 |
1 files 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 @@ | |||
1 | JSON performance under Lua | 1 | JSON module performance comparison under Lua |
2 | ========================== | 2 | ============================================ |
3 | Mark Pulford <mark@kyne.com.au> | ||
4 | :revdate: Janurary 21, 2012 | ||
5 | |||
6 | This performance comparison aims to provide a guide of relative | ||
7 | performance between several fast and popular JSON modules. | ||
8 | |||
9 | The examples used in this comparison were mostly sourced from the | ||
10 | http://json.org[JSON website] and | ||
11 | http://tools.ietf.org/html/rfc4627[RFC 4627]. | ||
12 | |||
13 | Performance will vary widely between platforms and data sets. These | ||
14 | results should only be used as an approximation. | ||
15 | |||
3 | 16 | ||
4 | Modules | 17 | Modules |
5 | ------- | 18 | ------- |
6 | 19 | ||
7 | The following fast JSON libraries for Lua were tested: | 20 | The following JSON modules for Lua were tested: |
8 | 21 | ||
9 | [horizontal] | ||
10 | http://chiselapp.com/user/dhkolf/repository/dkjson/[DKJSON 2.1]:: | 22 | http://chiselapp.com/user/dhkolf/repository/dkjson/[DKJSON 2.1]:: |
11 | - A Lua implementation with no dependencies | 23 | - Lua implementation with no dependencies on other libraries |
12 | - Also supports LPeg to improve decode performance | 24 | - Supports LPeg to improve decode performance |
13 | - Tested with/without LPeg 10.2 | ||
14 | https://github.com/brimworks/lua-yajl[Lua YAJL 2.0]:: | ||
15 | - A C wrapper for the YAJL library | ||
16 | - Built with YAJL 2.0.4 | ||
17 | http://www.kyne.com.au/~mark/software/lua-cjson.php[Lua CSJON 2.0.0]:: | ||
18 | - A C implementation with no dependencies on other libraries | ||
19 | - Tested with/without internal floating point conversion routines | ||
20 | 25 | ||
21 | The following Lua implementations were used for this comparison: | 26 | https://github.com/brimworks/lua-yajl[Lua YAJL 2.0]:: |
27 | - C wrapper for the YAJL library | ||
22 | 28 | ||
23 | - http://www.lua.org[Lua 5.1.4] | 29 | http://www.kyne.com.au/~mark/software/lua-cjson.php[Lua CSJON 2.0.0]:: |
24 | - http://www.luajit.org[LuaJIT 2.0.0-beta9] | 30 | - C implementation with no dependencies on other libraries |
25 | 31 | ||
26 | 32 | ||
27 | Summary | 33 | Summary |
28 | ------- | 34 | ------- |
29 | 35 | ||
30 | All libraries were built and used with their default settings. | 36 | All modules were built and tested as follows: |
31 | 37 | ||
32 | These results represent the number of JSON operations per second | 38 | DKJSON:: Tested with/without LPeg 10.2. |
33 | sustained by each module. All the results have been normalised against | 39 | Lua YAJL:: Tested with YAJL 2.0.4. |
34 | the pure Lua DKSJON implementation. | 40 | Lua CJSON:: Tested with Libc and internal floating point conversion |
41 | routines. | ||
42 | |||
43 | The 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 | |||
48 | These results show the number of JSON operations per second sustained by | ||
49 | each module. All results have been normalised against the pure Lua | ||
50 | DKJSON implementation. | ||
35 | 51 | ||
36 | .Decoding performance | 52 | .Decoding performance |
37 | ............................................................................ | 53 | ............................................................................ |
38 | | DKJSON +LPeg | Lua YAJL | Lua CJSON +fpconv | 54 | | DKJSON | Lua YAJL | Lua CJSON |
55 | | No LPeg With LPeg | | Libc Internal | ||
39 | | Lua JIT Lua JIT | Lua JIT | Lua JIT Lua JIT | 56 | | Lua JIT Lua JIT | Lua JIT | Lua JIT Lua JIT |
40 | example1 | 1x 2x 2.6x 3.4x | 7.1x 10x | 14x 20x 14x 20x | 57 | example1 | 1x 2x 2.6x 3.4x | 7.1x 10x | 14x 20x 14x 20x |
41 | example2 | 1x 2.2x 2.9x 4.4x | 6.7x 9.9x | 14x 22x 14x 22x | 58 | 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 | |||
46 | rfc-example1 | 1x 2.1x 2.8x 4.3x | 6.1x 8.1x | 13x 19x 14x 21x | 63 | rfc-example1 | 1x 2.1x 2.8x 4.3x | 6.1x 8.1x | 13x 19x 14x 21x |
47 | rfc-example2 | 1x 2.1x 3.1x 4.2x | 7.1x 9.2x | 15x 21x 17x 24x | 64 | rfc-example2 | 1x 2.1x 3.1x 4.2x | 7.1x 9.2x | 15x 21x 17x 24x |
48 | types | 1x 2.2x 2.6x 4.3x | 5.3x 7.4x | 12x 20x 13x 21x | 65 | types | 1x 2.2x 2.6x 4.3x | 5.3x 7.4x | 12x 20x 13x 21x |
66 | -------------|-------------------------|------------|----------------------- | ||
49 | = Average => | 1x 2.1x 2.7x 4.1x | 6.5x 9x | 13x 20x 14x 21x | 67 | = Average => | 1x 2.1x 2.7x 4.1x | 6.5x 9x | 13x 20x 14x 21x |
50 | ............................................................................ | 68 | ............................................................................ |
51 | 69 | ||
52 | .Encoding performance | 70 | .Encoding performance |
53 | ............................................................................. | 71 | ............................................................................. |
54 | | DKJSON +LPeg | Lua YAJL | Lua CJSON +fpconv | 72 | | DKJSON | Lua YAJL | Lua CJSON |
73 | | No LPeg With LPeg | | Libc Internal | ||
55 | | Lua JIT Lua JIT | Lua JIT | Lua JIT Lua JIT | 74 | | Lua JIT Lua JIT | Lua JIT | Lua JIT Lua JIT |
56 | example1 | 1x 1.8x 0.97x 1.6x | 3.1x 5.2x | 23x 29x 23x 29x | 75 | example1 | 1x 1.8x 0.97x 1.6x | 3.1x 5.2x | 23x 29x 23x 29x |
57 | example2 | 1x 2x 0.97x 1.7x | 2.6x 4.3x | 22x 28x 22x 28x | 76 | 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 | |||
62 | rfc-example1 | 1x 1.9x 0.97x 1.6x | 2.2x 3.2x | 8.5x 9.3x 11x 12x | 81 | rfc-example1 | 1x 1.9x 0.97x 1.6x | 2.2x 3.2x | 8.5x 9.3x 11x 12x |
63 | rfc-example2 | 1x 1.9x 0.98x 1.6x | 2.6x 3.9x | 10x 11x 17x 19x | 82 | rfc-example2 | 1x 1.9x 0.98x 1.6x | 2.6x 3.9x | 10x 11x 17x 19x |
64 | types | 1x 2.2x 0.97x 2x | 1.2x 1.9x | 11x 13x 12x 14x | 83 | types | 1x 2.2x 0.97x 2x | 1.2x 1.9x | 11x 13x 12x 14x |
84 | -------------|-------------------------|------------|----------------------- | ||
65 | = Average => | 1x 1.9x 0.98x 1.7x | 2.5x 3.9x | 14x 17x 16x 19x | 85 | = Average => | 1x 1.9x 0.98x 1.7x | 2.5x 3.9x | 14x 17x 16x 19x |
66 | ............................................................................. | 86 | ............................................................................. |
67 | 87 | ||
68 | Performance can vary widely between platforms and data sets. These | 88 | |
69 | results should only be used as a rough guide. | 89 | // vi:ft=asciidoc tw=72: |