Bug fix: actually make different tries in benchmark useful

This commit is contained in:
Robin Wellner 2016-02-16 14:38:01 +01:00
parent 348511c702
commit eb4c65ffcf

View File

@ -106,11 +106,14 @@ function love.draw()
resultname = "serialisation time in seconds" resultname = "serialisation time in seconds"
results_size = {} results_size = {}
results_deser = {} results_deser = {}
for sername, serializer in pairs(sers) do
results_ser[sername] = math.huge
results_deser[sername] = math.huge
end
local outputs = {} local outputs = {}
for try = 1, tries do for try = 1, tries do
for sername, serializer in pairs(sers) do for sername, serializer in pairs(sers) do
local output local output
results_ser[sername] = math.huge
local t = os.clock() local t = os.clock()
for i = 1, iters do for i = 1, iters do
output = serializer(data) output = serializer(data)
@ -129,7 +132,6 @@ function love.draw()
for try = 1, tries do for try = 1, tries do
for sername, deserializer in pairs(desers) do for sername, deserializer in pairs(desers) do
local input = outputs[sername] local input = outputs[sername]
results_deser[sername] = math.huge
local t = os.clock() local t = os.clock()
for i = 1, iters / 10 do for i = 1, iters / 10 do
deserializer(input) deserializer(input)