summaryrefslogtreecommitdiff
path: root/performance.txt
diff options
context:
space:
mode:
authorMark Pulford <mark@kyne.com.au>2011-05-04 23:48:54 +0930
committerMark Pulford <mark@kyne.com.au>2011-05-04 23:48:54 +0930
commit79363daeb78485d61ad6ff24600408e4b855308c (patch)
tree916ae622e2e2781f760d7aa718e102be12277e96 /performance.txt
parent6f1f110cce95f6d73454701bb5641e8edabbb1fb (diff)
downloadlua-cjson-79363daeb78485d61ad6ff24600408e4b855308c.tar.gz
lua-cjson-79363daeb78485d61ad6ff24600408e4b855308c.tar.bz2
lua-cjson-79363daeb78485d61ad6ff24600408e4b855308c.zip
Add benchmark results (performance.txt)
Diffstat (limited to 'performance.txt')
-rw-r--r--performance.txt42
1 files changed, 42 insertions, 0 deletions
diff --git a/performance.txt b/performance.txt
new file mode 100644
index 0000000..788eb9e
--- /dev/null
+++ b/performance.txt
@@ -0,0 +1,42 @@
1Performance comparison
2----------------------
3
4Here is a rough performance comparision of several JSON packages
5available for Lua:
6
7- DKJSON 1.0: One of the fastest pure Lua JSON implementations.
8- LuaJSON 1.0: A mixed Lua/C JSON implementation using LPeg.
9- CSJON 1.0: Pure C.
10
11The example JSON files used were taken from http://json.org/ and
12RFC 4627.
13
14 === DKJSON === == LuaJSON === === CJSON ====
15== Decoding == Lua LuaJIT Lua LuaJIT Lua LuaJIT
16example1.json 1.0x 1.9x 3.4x 3.9x 12.3x 13.7x
17example2.json 1.0x 2.0x 3.6x 4.6x 12.2x 20.0x
18example3.json 1.0x 2.0x 3.9x 4.7x 13.1x 18.8x
19example4.json 1.0x 1.8x 3.7x 4.4x 11.9x 17.0x
20example5.json 1.0x 1.5x 4.0x 4.8x 14.6x 22.2x
21rfc-example1.json 1.0x 1.5x 3.2x 4.3x 11.7x 16.9x
22rfc-example2.json 1.0x 1.5x 3.7x 4.5x 10.3x 19.4x
23== Average ==> 1.0x 1.7x 3.5x 4.2x 11.3x 16.5x
24
25== Encoding ==
26example1.json 1.0x 1.8x 0.6x 1.4x 23.5x 23.4x
27example2.json 1.0x 2.0x 0.5x 1.2x 22.4x 22.4x
28example3.json 1.0x 1.8x 0.6x 1.3x 10.8x 13.4x
29example4.json 1.0x 1.2x 0.7x 1.5x 15.7x 17.2x
30example5.json 1.0x 1.5x 0.6x 1.4x 22.1x 20.4x
31rfc-example1.json 1.0x 1.4x 0.5x 1.1x 8.9x 9.2x
32rfc-example2.json 1.0x 1.4x 0.6x 1.3x 10.4x 10.9x
33== Average ==> 1.0x 1.6x 0.6x 1.3x 17.0x 17.2x
34
35
36CJSON spends a significant amount of time calling sprintf() to convert
37doubles to strings while encoding "rfc-example1.json". Hence it only
38shows a 9x improvement in this case.
39
40The performance gains available can vary widely. If performance is
41critical, I would recommend testing in a relevant environment with
42your intended data.