This repository was archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchmark.lua
executable file
·55 lines (50 loc) · 1.72 KB
/
benchmark.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
--[[
Project TkJson-Lua
Author T1nKeR
File benchmark.lua
Description
The driver that runs the benchmark tasks.
--]]
local TkBench = require('source/TkBench')
local function MainApp()
TkBench.Reset()
local json_library = nil
-- Register 'TkJson'
json_library = require('source/TkJson')
TkBench.RegisterLibrary('TkJson', json_library.Decode, json_library.Encode)
-- Register 'dkjson'
json_library = require('bench/dkjson');
TkBench.RegisterLibrary('dkjson', json_library.decode, json_library.encode)
-- Register 'json.lua'
json_library = require('bench/json')
TkBench.RegisterLibrary('json.lua', json_library.decode, json_library.encode)
-- Register 'lunajson'
json_library = require('bench/lunajson')
TkBench.RegisterLibrary('lunajson', json_library.decode, json_library.encode)
-- Register 'jfjson'
-- jfjson takes more than 1 minute to parse the given json text.
--json_library = require('bench/jfjson')
--function json_library.decode(json_string)
-- return json_library:decode(json_string)
--end
--function json_library.encode(json_string)
-- return json_library:encode(json_string)
--end
--TkBench.RegisterLibrary('jfjson', json_library.decode, json_library.encode)
-- Register 'json4lua'
-- json4lua takes more than 1 minute to parse the given json text.
--json_library = require('bench/json4lua')
--TkBench.RegisterLibrary('json4lua', json_library.decode, json_library.encode)
local file_list = {
'test/canada.json',
'test/citm_catalog.json',
'test/twitter.json'
}
for key, value in pairs(file_list) do
TkBench.DecodeBenchmark(value)
end
-- for key, value in pairs(fileArray) do
-- TkBench.EncodeBenchmark(value)
-- end
end
MainApp()