File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,15 @@ local text = "[" .. string.rep([[{
36
36
}, ]] , 1000 ):sub (1 , - 3 ) .. " ]"
37
37
38
38
39
+ -- As this is meant to be a pure Lua benchmark, we remove the ability to
40
+ -- require 'lpeg' so dkjson doesn't use it for parsing. (Incidentally json.lua
41
+ -- seems to outperform libraries which use lpeg when both are using LuaJIT)
42
+ local _require = require
43
+ require = function (modname )
44
+ if modname == " lpeg" then error () end
45
+ return _require (modname )
46
+ end
47
+
39
48
-- Run benchmarks, store results
40
49
local results = {}
41
50
@@ -46,7 +55,7 @@ for i, name in ipairs(libs) do
46
55
end
47
56
local json = f ()
48
57
49
- -- Handle special cases
58
+ -- Remap functions to work for jfjson.lua
50
59
if name == " jfjson.lua" then
51
60
local _encode , _decode = json .encode , json .decode
52
61
json .encode = function (...) return _encode (json , ... ) end
You can’t perform that action at this time.
0 commit comments