Skip to content

Instantly share code, notes, and snippets.

@est31

est31/init.lua Secret

Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save est31/f4ad8d4403f29ca230e3 to your computer and use it in GitHub Desktop.
Save est31/f4ad8d4403f29ca230e3 to your computer and use it in GitHub Desktop.
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