{"action":"created","issue":{"url":"https://api.github.com/repos/minetest/minetest/issues/2210","labels_url":"https://api.github.com/repos/minetest/minetest/issues/2210/labels{/name}","comments_url":"https://api.github.com/repos/minetest/minetest/issues/2210/comments","events_url":"https://api.github.com/repos/minetest/minetest/issues/2210/events","html_url":"https://github.com/minetest/minetest/issues/2210","id":55473822,"number":2210,"title":"getCraftRecipes implementation is very slow","user":{"login":"est31","id":8872119,"avatar_url":"https://avatars.githubusercontent.com/u/8872119?v=3","gravatar_id":"","url":"https://api.github.com/users/est31","html_url":"https://github.com/est31","followers_url":"https://api.github.com/users/est31/followers","following_url":"https://api.github.com/users/est31/following{/other_user}","gists_url":"https://api.github.com/users/est31/gists{/gist_id}","starred_url":"https://api.github.com/users/est31/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/est31/subscriptions","organizations_url":"https://api.github.com/users/est31/orgs","repos_url":"https://api.github.com/users/est31/repos","events_url":"https://api.github.com/users/est31/events{/privacy}","received_events_url":"https://api.github.com/users/est31/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-01-26T11:48:47Z","updated_at":"2015-01-26T22:39:28Z","closed_at":null,"body":"The function [getCraftRecipes](https://github.com/minetest/minetest/blob/70074800a20/src/craftdef.cpp#L974) is very slow, and could do better than O(n) by eg. using hashtables. I've created a [minimal test](https://gist.github.com/est31/f4ad8d4403f29ca230e3) using conditions encountered by the dreambuilder game and the unified inventory. This issue causes unified inventory to load ~18 secs at the start of a game. During this time, no client can connect."},"comment":{"url":"https://api.github.com/repos/minetest/minetest/issues/comments/71553801","html_url":"https://github.com/minetest/minetest/issues/2210#issuecomment-71553801","issue_url":"https://api.github.com/repos/minetest/minetest/issues/2210","id":71553801,"user":{"login":"gregorycu","id":1516163,"avatar_url":"https://avatars.githubusercontent.com/u/1516163?v=3","gravatar_id":"","url":"https://api.github.com/users/gregorycu","html_url":"https://github.com/gregorycu","followers_url":"https://api.github.com/users/gregorycu/followers","following_url":"https://api.github.com/users/gregorycu/following{/other_user}","gists_url":"https://api.github.com/users/gregorycu/gists{/gist_id}","starred_url":"https://api.github.com/users/gregorycu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregorycu/subscriptions","organizations_url":"https://api.github.com/users/gregorycu/orgs","repos_url":"https://api.github.com/users/gregorycu/repos","events_url":"https://api.github.com/users/gregorycu/events{/privacy}","received_events_url":"https://api.github.com/users/gregorycu/received_events","type":"User","site_admin":false},"created_at":"2015-01-26T22:39:28Z","updated_at":"2015-01-26T22:39:28Z","body":"Anyway, I've been thinking about this some more. While existing API functions should be fast enough to not cause issues, it's possible that the method existing in the first place is a mistake.\r\n\r\nIn my mind, there should be two additional methods created. get_registered and register_on_register.\r\n\r\nBoth these functions accept a parameter of \"type\"  and allow you to inspect any type of thing that can be registered. The first method returns an iterator that will iterate over the entire collection. The second allows you to register a function that will be called when the corresponding register function has been called. This means mood authors can hook into the registration of things (such as recipes, items etc) This means mod authors can be less concerned about mod startup order.\r\n\r\nThere would have to be benchmarking to ensure such a system doesn't allow everything drastically."}}