Added warmup for JIT in benchmark scripts

pull/6/head
rxi 2015-08-14 19:21:42 +01:00
parent 8cb56f3d73
commit 9720bb9f10
2 changed files with 6 additions and 0 deletions

View File

@ -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)

View File

@ -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)