diff --git a/bench/bench_decode.lua b/bench/bench_decode.lua index fd94e0e..6c2e93a 100644 --- a/bench/bench_decode.lua +++ b/bench/bench_decode.lua @@ -62,6 +62,9 @@ for i, name in ipairs(libs) do json.decode = function(...) return _decode(json, ...) end end + -- Warmup (for LuaJIT) + bench.run(name, 1, function() json.decode(text) end) + -- Run and push results local res = bench.run(name, 10, function() json.decode(text) end) table.insert(results, res) diff --git a/bench/bench_encode.lua b/bench/bench_encode.lua index 119e2d8..426f7c8 100644 --- a/bench/bench_encode.lua +++ b/bench/bench_encode.lua @@ -50,6 +50,9 @@ for i, name in ipairs(libs) do json.decode = function(...) return _decode(json, ...) end end + -- Warmup (for LuaJIT) + bench.run(name, 1, function() json.encode(data) end) + -- Run and push results local res = bench.run(name, 10, function() json.encode(data) end) table.insert(results, res)