{"action":"created","comment":{"url":"https://api.github.com/repos/minetest/minetest/pulls/comments/23744655","id":23744655,"diff_hunk":"@@ -975,37 +975,20 @@ class CCraftDefManager: public IWritableCraftDefManager\n \t\t\tIGameDef *gamedef) const\n \t{\n \t\tstd::vector<CraftDefinition*> recipes_list;\n-\t\tCraftInput input;\n-\t\tCraftOutput tmpout;\n-\t\ttmpout.item = \"\";\n-\t\ttmpout.time = 0;\n \n-\t\tfor(std::vector<CraftDefinition*>::const_reverse_iterator\n-\t\t\t\ti = m_craft_definitions.rbegin();\n-\t\t\t\ti != m_craft_definitions.rend(); i++)\n-\t\t{\n-\t\t\tCraftDefinition *def = *i;\n+\t\tstd::map<std::string, std::vector<CraftDefinition*> >::const_iterator vecIter =\n+\t\t\tm_output_to_craft_definition_map.find(output.item);\n \n-\t\t\t/*infostream<<\"Checking \"<<input.dump()<<std::endl\n-\t\t\t\t\t<<\" against \"<<def->dump()<<std::endl;*/\n+\t\tif (vecIter == m_output_to_craft_definition_map.end())\n+\t\t\treturn recipes_list;\n \n-\t\t\ttry {\n-\t\t\t\ttmpout = def->getOutput(input, gamedef);\n-\t\t\t\tif(tmpout.item.substr(0,output.item.length()) == output.item)\n-\t\t\t\t{\n-\t\t\t\t\t// Get output, then decrement input (if requested)\n-\t\t\t\t\tinput = def->getInput(output, gamedef);\n-\t\t\t\t\trecipes_list.push_back(*i);\n-\t\t\t\t}\n-\t\t\t}\n-\t\t\tcatch(SerializationError &e)\n-\t\t\t{\n-\t\t\t\terrorstream<<\"getCraftResult: ERROR: \"\n-\t\t\t\t\t\t<<\"Serialization error in recipe \"\n-\t\t\t\t\t\t<<def->dump()<<std::endl;\n-\t\t\t\t// then go on with the next craft definition\n-\t\t\t}\n+\t\tfor(std::vector<CraftDefinition*>::const_reverse_iterator\n+\t\t\ti = vecIter->second.rbegin();\n+\t\t\ti != vecIter->second.rend(); i++)\n+\t\t{\n+\t\t\trecipes_list.push_back(*i);\n \t\t}\n+\t\t\t","path":"src/craftdef.cpp","position":44,"original_position":44,"commit_id":"7ad3f9c4ae9e4ec2679e3a657a7eccbb1ea7dcff","original_commit_id":"7ad3f9c4ae9e4ec2679e3a657a7eccbb1ea7dcff","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},"body":"I'll look at it in 8 hours.","created_at":"2015-01-29T03:29:05Z","updated_at":"2015-01-29T03:29:05Z","html_url":"https://github.com/minetest/minetest/pull/2225#discussion_r23744655","pull_request_url":"https://api.github.com/repos/minetest/minetest/pulls/2225","_links":{"self":{"href":"https://api.github.com/repos/minetest/minetest/pulls/comments/23744655"},"html":{"href":"https://github.com/minetest/minetest/pull/2225#discussion_r23744655"},"pull_request":{"href":"https://api.github.com/repos/minetest/minetest/pulls/2225"}}},"pull_request":{"url":"https://api.github.com/repos/minetest/minetest/pulls/2225","id":28194823,"html_url":"https://github.com/minetest/minetest/pull/2225","diff_url":"https://github.com/minetest/minetest/pull/2225.diff","patch_url":"https://github.com/minetest/minetest/pull/2225.patch","issue_url":"https://api.github.com/repos/minetest/minetest/issues/2225","number":2225,"state":"open","locked":false,"title":"Speed up CCraftDefManager::getCraftRecipes by orders of magnitude","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},"body":"Feedback in GitHub only please.\r\nThis is to fix #2210 .\r\nThis speed up the function by a few orders of magnitude, but it slows down the registration of recipes by 40%.","created_at":"2015-01-28T13:55:10Z","updated_at":"2015-01-29T03:29:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ff93b3ad6e901a522ea28458b4ee0b0d83c893d2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/minetest/minetest/pulls/2225/commits","review_comments_url":"https://api.github.com/repos/minetest/minetest/pulls/2225/comments","review_comment_url":"https://api.github.com/repos/minetest/minetest/pulls/comments/{number}","comments_url":"https://api.github.com/repos/minetest/minetest/issues/2225/comments","statuses_url":"https://api.github.com/repos/minetest/minetest/statuses/7ad3f9c4ae9e4ec2679e3a657a7eccbb1ea7dcff","head":{"label":"gregorycu:Issue-2210","ref":"Issue-2210","sha":"7ad3f9c4ae9e4ec2679e3a657a7eccbb1ea7dcff","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},"repo":{"id":29135581,"name":"minetest","full_name":"gregorycu/minetest","owner":{"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},"private":false,"html_url":"https://github.com/gregorycu/minetest","description":"Minetest, an open source infinite-world block sandbox game with survival and crafting. [also https://github.com/minetest/minetest_game]","fork":true,"url":"https://api.github.com/repos/gregorycu/minetest","forks_url":"https://api.github.com/repos/gregorycu/minetest/forks","keys_url":"https://api.github.com/repos/gregorycu/minetest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gregorycu/minetest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gregorycu/minetest/teams","hooks_url":"https://api.github.com/repos/gregorycu/minetest/hooks","issue_events_url":"https://api.github.com/repos/gregorycu/minetest/issues/events{/number}","events_url":"https://api.github.com/repos/gregorycu/minetest/events","assignees_url":"https://api.github.com/repos/gregorycu/minetest/assignees{/user}","branches_url":"https://api.github.com/repos/gregorycu/minetest/branches{/branch}","tags_url":"https://api.github.com/repos/gregorycu/minetest/tags","blobs_url":"https://api.github.com/repos/gregorycu/minetest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gregorycu/minetest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gregorycu/minetest/git/refs{/sha}","trees_url":"https://api.github.com/repos/gregorycu/minetest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gregorycu/minetest/statuses/{sha}","languages_url":"https://api.github.com/repos/gregorycu/minetest/languages","stargazers_url":"https://api.github.com/repos/gregorycu/minetest/stargazers","contributors_url":"https://api.github.com/repos/gregorycu/minetest/contributors","subscribers_url":"https://api.github.com/repos/gregorycu/minetest/subscribers","subscription_url":"https://api.github.com/repos/gregorycu/minetest/subscription","commits_url":"https://api.github.com/repos/gregorycu/minetest/commits{/sha}","git_commits_url":"https://api.github.com/repos/gregorycu/minetest/git/commits{/sha}","comments_url":"https://api.github.com/repos/gregorycu/minetest/comments{/number}","issue_comment_url":"https://api.github.com/repos/gregorycu/minetest/issues/comments/{number}","contents_url":"https://api.github.com/repos/gregorycu/minetest/contents/{+path}","compare_url":"https://api.github.com/repos/gregorycu/minetest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gregorycu/minetest/merges","archive_url":"https://api.github.com/repos/gregorycu/minetest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gregorycu/minetest/downloads","issues_url":"https://api.github.com/repos/gregorycu/minetest/issues{/number}","pulls_url":"https://api.github.com/repos/gregorycu/minetest/pulls{/number}","milestones_url":"https://api.github.com/repos/gregorycu/minetest/milestones{/number}","notifications_url":"https://api.github.com/repos/gregorycu/minetest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gregorycu/minetest/labels{/name}","releases_url":"https://api.github.com/repos/gregorycu/minetest/releases{/id}","created_at":"2015-01-12T13:00:30Z","updated_at":"2015-01-26T08:39:02Z","pushed_at":"2015-01-28T13:38:49Z","git_url":"git://github.com/gregorycu/minetest.git","ssh_url":"git@github.com:gregorycu/minetest.git","clone_url":"https://github.com/gregorycu/minetest.git","svn_url":"https://github.com/gregorycu/minetest","homepage":"http://minetest.net/","size":32182,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"minetest:master","ref":"master","sha":"4d15d631349005528e8578a5750ad9a1b8cefe39","user":{"login":"minetest","id":2624745,"avatar_url":"https://avatars.githubusercontent.com/u/2624745?v=3","gravatar_id":"","url":"https://api.github.com/users/minetest","html_url":"https://github.com/minetest","followers_url":"https://api.github.com/users/minetest/followers","following_url":"https://api.github.com/users/minetest/following{/other_user}","gists_url":"https://api.github.com/users/minetest/gists{/gist_id}","starred_url":"https://api.github.com/users/minetest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minetest/subscriptions","organizations_url":"https://api.github.com/users/minetest/orgs","repos_url":"https://api.github.com/users/minetest/repos","events_url":"https://api.github.com/users/minetest/events{/privacy}","received_events_url":"https://api.github.com/users/minetest/received_events","type":"Organization","site_admin":false},"repo":{"id":2168780,"name":"minetest","full_name":"minetest/minetest","owner":{"login":"minetest","id":2624745,"avatar_url":"https://avatars.githubusercontent.com/u/2624745?v=3","gravatar_id":"","url":"https://api.github.com/users/minetest","html_url":"https://github.com/minetest","followers_url":"https://api.github.com/users/minetest/followers","following_url":"https://api.github.com/users/minetest/following{/other_user}","gists_url":"https://api.github.com/users/minetest/gists{/gist_id}","starred_url":"https://api.github.com/users/minetest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minetest/subscriptions","organizations_url":"https://api.github.com/users/minetest/orgs","repos_url":"https://api.github.com/users/minetest/repos","events_url":"https://api.github.com/users/minetest/events{/privacy}","received_events_url":"https://api.github.com/users/minetest/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/minetest/minetest","description":"Minetest, an open source infinite-world block sandbox game with survival and crafting. [also https://github.com/minetest/minetest_game]","fork":false,"url":"https://api.github.com/repos/minetest/minetest","forks_url":"https://api.github.com/repos/minetest/minetest/forks","keys_url":"https://api.github.com/repos/minetest/minetest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/minetest/minetest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/minetest/minetest/teams","hooks_url":"https://api.github.com/repos/minetest/minetest/hooks","issue_events_url":"https://api.github.com/repos/minetest/minetest/issues/events{/number}","events_url":"https://api.github.com/repos/minetest/minetest/events","assignees_url":"https://api.github.com/repos/minetest/minetest/assignees{/user}","branches_url":"https://api.github.com/repos/minetest/minetest/branches{/branch}","tags_url":"https://api.github.com/repos/minetest/minetest/tags","blobs_url":"https://api.github.com/repos/minetest/minetest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/minetest/minetest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/minetest/minetest/git/refs{/sha}","trees_url":"https://api.github.com/repos/minetest/minetest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/minetest/minetest/statuses/{sha}","languages_url":"https://api.github.com/repos/minetest/minetest/languages","stargazers_url":"https://api.github.com/repos/minetest/minetest/stargazers","contributors_url":"https://api.github.com/repos/minetest/minetest/contributors","subscribers_url":"https://api.github.com/repos/minetest/minetest/subscribers","subscription_url":"https://api.github.com/repos/minetest/minetest/subscription","commits_url":"https://api.github.com/repos/minetest/minetest/commits{/sha}","git_commits_url":"https://api.github.com/repos/minetest/minetest/git/commits{/sha}","comments_url":"https://api.github.com/repos/minetest/minetest/comments{/number}","issue_comment_url":"https://api.github.com/repos/minetest/minetest/issues/comments/{number}","contents_url":"https://api.github.com/repos/minetest/minetest/contents/{+path}","compare_url":"https://api.github.com/repos/minetest/minetest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/minetest/minetest/merges","archive_url":"https://api.github.com/repos/minetest/minetest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/minetest/minetest/downloads","issues_url":"https://api.github.com/repos/minetest/minetest/issues{/number}","pulls_url":"https://api.github.com/repos/minetest/minetest/pulls{/number}","milestones_url":"https://api.github.com/repos/minetest/minetest/milestones{/number}","notifications_url":"https://api.github.com/repos/minetest/minetest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/minetest/minetest/labels{/name}","releases_url":"https://api.github.com/repos/minetest/minetest/releases{/id}","created_at":"2011-08-07T13:48:36Z","updated_at":"2015-01-28T13:44:07Z","pushed_at":"2015-01-28T04:14:14Z","git_url":"git://github.com/minetest/minetest.git","ssh_url":"git@github.com:minetest/minetest.git","clone_url":"https://github.com/minetest/minetest.git","svn_url":"https://github.com/minetest/minetest","homepage":"http://minetest.net/","size":79279,"stargazers_count":1344,"watchers_count":1344,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":456,"mirror_url":null,"open_issues_count":489,"forks":456,"open_issues":489,"watchers":1344,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/minetest/minetest/pulls/2225"},"html":{"href":"https://github.com/minetest/minetest/pull/2225"},"issue":{"href":"https://api.github.com/repos/minetest/minetest/issues/2225"},"comments":{"href":"https://api.github.com/repos/minetest/minetest/issues/2225/comments"},"review_comments":{"href":"https://api.github.com/repos/minetest/minetest/pulls/2225/comments"},"review_comment":{"href":"https://api.github.com/repos/minetest/minetest/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/minetest/minetest/pulls/2225/commits"},"statuses":{"href":"https://api.github.com/repos/minetest/minetest/statuses/7ad3f9c4ae9e4ec2679e3a657a7eccbb1ea7dcff"}}}}