Skip to content

Instantly share code, notes, and snippets.

@est31

est31/init.lua Secret

Last active Aug 29, 2015
Embed
What would you like to do?
minetest-getCraftRecipes-minimal-example
--
-- Minimal Development Test
-- Mod: test
--
local x = minetest.get_us_time()
local cnt = 20000
--simulate a heavily modded game like dreambuilder
print('filling up the craft table...')
while cnt ~= 0 do
minetest.register_craft({
output = "test:whatever"..cnt,
recipe = {
{"default:cobble", "default:cobble"},
{"default:cobble", "default:cobble"},
}
})
cnt = cnt - 1
end
local y = minetest.get_us_time()
print('time spent registering: '..(y-x))
print('starting the loop... ')
cnt = 2325 -- change it to 10 if you want to spend your time profiling and not waiting for a result
while cnt ~= 0 do
minetest.get_all_craft_recipes("test:whatever"..cnt)
cnt = cnt - 1
end
y = minetest.get_us_time()
print('time spent looking up: '..(y-x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment