diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/bench.lua | 2 | ||||
-rw-r--r-- | tests/types.json | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/tests/bench.lua b/tests/bench.lua index c1808cf..0e2a75c 100755 --- a/tests/bench.lua +++ b/tests/bench.lua | |||
@@ -12,12 +12,14 @@ local json = require "cjson" | |||
12 | 12 | ||
13 | function benchmark(tests, iter, rep) | 13 | function benchmark(tests, iter, rep) |
14 | local function bench(func, iter) | 14 | local function bench(func, iter) |
15 | -- collectgarbage("stop") | ||
15 | collectgarbage("collect") | 16 | collectgarbage("collect") |
16 | local t = socket.gettime() | 17 | local t = socket.gettime() |
17 | for i = 1, iter do | 18 | for i = 1, iter do |
18 | func(i) | 19 | func(i) |
19 | end | 20 | end |
20 | t = socket.gettime() - t | 21 | t = socket.gettime() - t |
22 | -- collectgarbage("restart") | ||
21 | return (iter / t) | 23 | return (iter / t) |
22 | end | 24 | end |
23 | 25 | ||
diff --git a/tests/types.json b/tests/types.json new file mode 100644 index 0000000..c01e7d2 --- /dev/null +++ b/tests/types.json | |||
@@ -0,0 +1 @@ | |||
{ "array": [ 10, true, null ] } | |||