Add timing for boxes.save()

This commit is contained in:
Auke Kok 2019-09-11 21:50:30 -07:00
parent 207de4dc2c
commit 3d090e5940

View File

@ -31,6 +31,7 @@ local function bytes_to_string(bytes)
end
function boxes.save(minp, maxp)
local t1 = os.clock()
--[[ TODO: save the box in incremental steps to avoid stalling the server. The
problem is that we have to iterate over all positions since there is no way
to get the metadata of all nodes in an area, although the engine can.
@ -166,7 +167,15 @@ function boxes.save(minp, maxp)
end
local raw_data = bytes_to_string(flat_data)
return minetest.compress(raw_data, "deflate")
local t2 = os.clock()
local cc = minetest.compress(raw_data, "deflate")
local t3 = os.clock()
minetest.log("action", "boxes.save: " .. ((t2 - t1) * 100) .. ", " .. ((t3 - t2) * 100))
return cc
end
function boxes.load(minp, box_id, player)