_start = os.clock() for i=1,4096,1 do minetest.register_craftitem( "benchmark_clear_craft:item_" .. tostring(i), { description = "item_" .. tostring(i) } ) end _end = os.clock() minetest.debug( "time to register 4096 craftitems: " .. tostring(_end - _start) ) _start = os.clock() for i=1,4096,1 do minetest.register_craft({ output = "benchmark_clear_craft:item_" .. tostring(i), type = "shapeless", recipe = { "benchmark_clear_craft:item_" .. tostring(i) } }) end _end = os.clock() minetest.debug( "time to register 4096 crafts: " .. tostring(_end - _start) ) _start = os.clock() for i=1,2048,1 do minetest.clear_craft({ output = "benchmark_clear_craft:item_" .. tostring(i), }) end _end = os.clock() minetest.debug( "time to clear 2048 crafts based on output: " .. tostring(_end - _start) ) _start = os.clock() for i=2049,4096,1 do minetest.clear_craft({ type = "shapeless", recipe = { "benchmark_clear_craft:item_" .. tostring(i) } }) end _end = os.clock() minetest.debug( "time to clear 2048 crafts based on recipe: " .. tostring(_end - _start) ) --[[ 2022-05-12 23:22:26: [Main]: time to register 4096 craftitems: 0.066811 2022-05-12 23:22:26: [Main]: time to register 4096 crafts: 0.065608 2022-05-12 23:22:26: [Main]: time to clear 2048 crafts based on output: 0.01529 2022-05-12 23:22:53: [Main]: time to clear 2048 crafts based on recipe: 24.10416 ]]--