aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Pulford <mark@kyne.com.au>2011-05-29 23:19:47 +0930
committerMark Pulford <mark@kyne.com.au>2011-05-29 23:19:47 +0930
commit9ff9c8e34355dd3ef211af24edfba85e5b9b29af (patch)
treed7803a3dcf4130d6a9581fbdbf3c00f284c0abda
parent7e95a594465453f77b7c9449a3a486771e174111 (diff)
downloadlua-cjson-9ff9c8e34355dd3ef211af24edfba85e5b9b29af.tar.gz
lua-cjson-9ff9c8e34355dd3ef211af24edfba85e5b9b29af.tar.bz2
lua-cjson-9ff9c8e34355dd3ef211af24edfba85e5b9b29af.zip
Update performance.txt for 1.0.2
-rw-r--r--performance.txt77
1 files changed, 43 insertions, 34 deletions
diff --git a/performance.txt b/performance.txt
index 788eb9e..51c61ec 100644
--- a/performance.txt
+++ b/performance.txt
@@ -1,42 +1,51 @@
1Performance comparison 1JSON Performance Comparison under Lua
2---------------------- 2-------------------------------------
3 3
4Here is a rough performance comparision of several JSON packages 4The following JSON packages for Lua were tested:
5available for Lua:
6 5
7- DKJSON 1.0: One of the fastest pure Lua JSON implementations. 6- DKJSON 1.0: One of the fastest pure Lua JSON implementations.
8- LuaJSON 1.0: A mixed Lua/C JSON implementation using LPeg. 7- LuaJSON 1.0: A mixed Lua/C JSON implementation using LPeg.
9- CSJON 1.0: Pure C. 8- Lua YAJL 2.0: A Lua wrapper for the YAJL JSON library.
9- CSJON 1.0.2: Pure C.
10
11LuaJSON 1.2.2 appeared to be slower during initial testing, so 1.0 was
12used instead.
13
14The following Lua implementations were used for this comparison:
15- Lua 5.1.4
16- LuaJIT 2.0.0-beta7
10 17
11The example JSON files used were taken from http://json.org/ and 18The example JSON files used were taken from http://json.org/ and
12RFC 4627. 19RFC 4627.
13 20
14 === DKJSON === == LuaJSON === === CJSON ==== 21 DKJSON 1.0 LuaJSON 1.0 LuaYAJL 2.0 CJSON 1.0.2
15== Decoding == Lua LuaJIT Lua LuaJIT Lua LuaJIT 22== Decoding == Lua LuaJIT Lua LuaJIT Lua LuaJIT Lua LuaJIT
16example1.json 1.0x 1.9x 3.4x 3.9x 12.3x 13.7x 23example1 1.0x 2.0x 3.4x 4.0x 7.1x 10.1x 13.2x 19.4x
17example2.json 1.0x 2.0x 3.6x 4.6x 12.2x 20.0x 24example2 1.0x 2.1x 3.5x 4.5x 6.6x 9.8x 12.7x 20.0x
18example3.json 1.0x 2.0x 3.9x 4.7x 13.1x 18.8x 25example3 1.0x 2.0x 3.9x 4.7x 7.0x 9.4x 13.2x 19.3x
19example4.json 1.0x 1.8x 3.7x 4.4x 11.9x 17.0x 26example4 1.0x 1.9x 3.7x 4.4x 7.4x 10.6x 11.8x 18.0x
20example5.json 1.0x 1.5x 4.0x 4.8x 14.6x 22.2x 27example5 1.0x 2.1x 4.0x 4.7x 7.7x 11.4x 14.7x 22.3x
21rfc-example1.json 1.0x 1.5x 3.2x 4.3x 11.7x 16.9x 28numbers 1.0x 2.1x 2.1x 3.4x 4.6x 5.7x 8.6x 10.4x
22rfc-example2.json 1.0x 1.5x 3.7x 4.5x 10.3x 19.4x 29rfc-example1 1.0x 2.0x 3.2x 4.2x 5.8x 8.2x 11.8x 17.7x
23== Average ==> 1.0x 1.7x 3.5x 4.2x 11.3x 16.5x 30rfc-example2 1.0x 2.0x 3.6x 4.5x 7.0x 9.3x 14.5x 20.5x
24 31types 1.0x 2.1x 2.3x 3.5x 4.9x 7.6x 10.7x 17.2x
25== Encoding == 32== Average ==> 1.0x 2.0x 3.3x 4.2x 6.4x 9.1x 12.4x 18.3x
26example1.json 1.0x 1.8x 0.6x 1.4x 23.5x 23.4x 33
27example2.json 1.0x 2.0x 0.5x 1.2x 22.4x 22.4x 34== Encoding ==
28example3.json 1.0x 1.8x 0.6x 1.3x 10.8x 13.4x 35example1 1.0x 1.9x 0.6x 1.4x 3.5x 5.6x 23.1x 29.1x
29example4.json 1.0x 1.2x 0.7x 1.5x 15.7x 17.2x 36example2 1.0x 2.0x 0.5x 1.2x 3.0x 4.9x 23.4x 28.5x
30example5.json 1.0x 1.5x 0.6x 1.4x 22.1x 20.4x 37example3 1.0x 1.8x 0.6x 1.3x 3.0x 4.7x 13.3x 14.9x
31rfc-example1.json 1.0x 1.4x 0.5x 1.1x 8.9x 9.2x 38example4 1.0x 1.7x 0.7x 1.5x 4.2x 6.6x 15.4x 18.5x
32rfc-example2.json 1.0x 1.4x 0.6x 1.3x 10.4x 10.9x 39example5 1.0x 2.0x 0.6x 1.4x 3.4x 5.5x 22.7x 25.5x
33== Average ==> 1.0x 1.6x 0.6x 1.3x 17.0x 17.2x 40numbers 1.0x 2.4x 0.4x 0.9x 1.4x 2.1x 4.3x 4.6x
34 41rfc-example1 1.0x 1.9x 0.5x 1.2x 2.3x 3.6x 8.8x 9.6x
35 42rfc-example2 1.0x 1.9x 0.6x 1.3x 2.8x 4.3x 10.7x 10.7x
36CJSON spends a significant amount of time calling sprintf() to convert 43types 1.0x 2.4x 0.3x 0.7x 1.4x 2.3x 11.7x 11.3x
37doubles to strings while encoding "rfc-example1.json". Hence it only 44== Average ==> 1.0x 2.0x 0.6x 1.2x 2.8x 4.4x 14.8x 17.0x
38shows a 9x improvement in this case. 45
39 46
40The performance gains available can vary widely. If performance is 47Number conversion is a relatively expensive operation. Number heavy
41critical, I would recommend testing in a relevant environment with 48JSON will show less performance difference between libraries.
42your intended data. 49
50Performance can vary widely between platforms and data sets. These
51results should only be considered as a rough guide.