mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
changes2
This commit is contained in:
parent
90b80d52a8
commit
72fd9cedaf
1 changed files with 14 additions and 11 deletions
|
@ -130,12 +130,12 @@ core.register_chatcommand("bench_bulk_get_node", {
|
|||
return false, "No player."
|
||||
end
|
||||
local pos_list = get_positions_cube(player:get_pos())
|
||||
local dummy = 0
|
||||
local function bench()
|
||||
local start_time = core.get_us_time()
|
||||
local dummy = 0
|
||||
for i = 1, #pos_list do
|
||||
local n = core.get_node(pos_list[i])
|
||||
-- Make sure the name lookup is not optimized away
|
||||
-- Make sure the name lookup is not optimized away (can this even happen?)
|
||||
dummy = dummy + #n.name
|
||||
end
|
||||
return core.get_us_time() - start_time
|
||||
|
@ -163,9 +163,9 @@ core.register_chatcommand("bench_bulk_get_node_raw", {
|
|||
return false, "No player."
|
||||
end
|
||||
local pos_list = get_positions_cube(player:get_pos())
|
||||
local dummy = 0
|
||||
local function bench()
|
||||
local start_time = core.get_us_time()
|
||||
local dummy = 0
|
||||
for i = 1, #pos_list do
|
||||
local pos_i = pos_list[i]
|
||||
local nid = core.get_node_raw(pos_i.x, pos_i.y, pos_i.z)
|
||||
|
@ -197,9 +197,9 @@ core.register_chatcommand("bench_bulk_get_node_raw2", {
|
|||
return false, "No player."
|
||||
end
|
||||
local pos_list = get_positions_cube(player:get_pos())
|
||||
local dummy = 0
|
||||
local function bench()
|
||||
local start_time = core.get_us_time()
|
||||
local dummy = 0
|
||||
for i = 1, #pos_list do
|
||||
local pos_i = pos_list[i]
|
||||
local nid = core.get_node_raw(pos_i.x, pos_i.y, pos_i.z)
|
||||
|
@ -232,12 +232,15 @@ core.register_chatcommand("bench_bulk_get_node_vm", {
|
|||
return false, "No player."
|
||||
end
|
||||
local pos = player:get_pos()
|
||||
local dummy = 0
|
||||
local function bench()
|
||||
local start_time = core.get_us_time()
|
||||
local vm = core.get_voxel_manip(pos:offset(1,1,1), pos:offset(100,100,100))
|
||||
local data = vm:get_data()
|
||||
local mid_time = core.get_us_time()
|
||||
local dummy = 0
|
||||
-- Note that the VManip will actually retrieve more than just the 100³ nodes
|
||||
-- and also we don't need to iterate pos_list here, so it's not an entirely
|
||||
-- fair comparison.
|
||||
for i = 1, 99*99*99 do
|
||||
local nid = data[i]
|
||||
-- Make sure the table lookup is not optimized away
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue