{"action":"created","comment":{"url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/pulls/comments/40149830","id":40149830,"diff_hunk":"@@ -0,0 +1,89 @@\n+/*\n+ * This file is part of Applied Energistics 2.\n+ * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.\n+ *\n+ * Applied Energistics 2 is free software: you can redistribute it and/or modify\n+ * it under the terms of the GNU Lesser General Public License as published by\n+ * the Free Software Foundation, either version 3 of the License, or\n+ * (at your option) any later version.\n+ *\n+ * Applied Energistics 2 is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+ * GNU Lesser General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU Lesser General Public License\n+ * along with Applied Energistics 2.  If not, see <http://www.gnu.org/licenses/lgpl>.\n+ */\n+\n+package appeng.util.item;\n+\n+\n+import java.util.Iterator;\n+import java.util.NavigableMap;\n+\n+import appeng.api.storage.data.IAEItemStack;\n+\n+\n+public class MeaningfulItemIterator<T extends IAEItemStack> implements Iterator<T>","path":"src/main/java/appeng/util/item/MeaningfulItemIterator.java","position":28,"original_position":28,"commit_id":"1121b11249aaece1aaa0e81009d01ed6c6ce52d4","original_commit_id":"1121b11249aaece1aaa0e81009d01ed6c6ce52d4","user":{"login":"yueh","id":151949,"avatar_url":"https://avatars.githubusercontent.com/u/151949?v=3","gravatar_id":"","url":"https://api.github.com/users/yueh","html_url":"https://github.com/yueh","followers_url":"https://api.github.com/users/yueh/followers","following_url":"https://api.github.com/users/yueh/following{/other_user}","gists_url":"https://api.github.com/users/yueh/gists{/gist_id}","starred_url":"https://api.github.com/users/yueh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yueh/subscriptions","organizations_url":"https://api.github.com/users/yueh/orgs","repos_url":"https://api.github.com/users/yueh/repos","events_url":"https://api.github.com/users/yueh/events{/privacy}","received_events_url":"https://api.github.com/users/yueh/received_events","type":"User","site_admin":false},"body":"`FluidList` has its own iterator as they are no longer share the same implementation. Thus `IAEItemStack` is perfectly valid.","created_at":"2015-09-22T21:56:51Z","updated_at":"2015-09-22T21:56:51Z","html_url":"https://github.com/AppliedEnergistics/Applied-Energistics-2/pull/1877#discussion_r40149830","pull_request_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/pulls/1877","_links":{"self":{"href":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/pulls/comments/40149830"},"html":{"href":"https://github.com/AppliedEnergistics/Applied-Energistics-2/pull/1877#discussion_r40149830"},"pull_request":{"href":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/pulls/1877"}}},"pull_request":{"url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/pulls/1877","id":45058536,"html_url":"https://github.com/AppliedEnergistics/Applied-Energistics-2/pull/1877","diff_url":"https://github.com/AppliedEnergistics/Applied-Energistics-2/pull/1877.diff","patch_url":"https://github.com/AppliedEnergistics/Applied-Energistics-2/pull/1877.patch","issue_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/issues/1877","number":1877,"state":"open","locked":false,"title":"ItemList refactoring","user":{"login":"yueh","id":151949,"avatar_url":"https://avatars.githubusercontent.com/u/151949?v=3","gravatar_id":"","url":"https://api.github.com/users/yueh","html_url":"https://github.com/yueh","followers_url":"https://api.github.com/users/yueh/followers","following_url":"https://api.github.com/users/yueh/following{/other_user}","gists_url":"https://api.github.com/users/yueh/gists{/gist_id}","starred_url":"https://api.github.com/users/yueh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yueh/subscriptions","organizations_url":"https://api.github.com/users/yueh/orgs","repos_url":"https://api.github.com/users/yueh/repos","events_url":"https://api.github.com/users/yueh/events{/privacy}","received_events_url":"https://api.github.com/users/yueh/received_events","type":"User","site_admin":false},"body":"Splitted the ItemList and MeaningfulIterator into an item and fluid version.\r\nAdded an IdentityHashMap as additional item layer to the ItemList for faster access.\r\nThe FluidList is a copy of the old ItemList.\r\n\r\nThe general approach is to use a `IdentityHashMap` on the item layer to speed up the access to a single item type. As `Item` is using a flyweight pattern, we can switch a `HashMap` for the slightly faster `IdentityHashMap`.\r\nThis actually mimics our intention with the fuzzy sorting, as this is only require on a per `Item` level, not over the whole collection. Thus it replaces the `O(log n)` in a deep tree with an access with `O(1)` and `O(log n)` on a very shallow tree. This also applies to oredict based searching, as this is based on merging different distinct items together into a collection.\r\n\r\nIt does result in a clear improvement under normal condition (about 50% less cpu consumed). Very high load can still be an issue (moving about 1024 itemtyps/tick through a network). Maybe it results in actually more items moved per tick, but this is really hard to track down as long as it is CPU gated.\r\n\r\nThe main issue prevent better optimizations is still the `MeaningfulItemIterator`. Due to the change it will now put a bit more load into the system as it needs to handle a second inner collection. But overall it is still a solid improvement. Getting rid of the actual self cleaning and replace it with a more fine grained explicitly cleanup is the main requirement here. Which will most likely require an API break.\r\n\r\nSpecial thanks to @sfPlayer1 for the idea of using a `IdentityHashMap` and split the collection.\r\n\r\n","created_at":"2015-09-15T14:46:57Z","updated_at":"2015-09-22T21:56:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"612b45d5b7bf28f5e4be51fb0c891a43c2ea3957","assignee":{"login":"thatsIch","id":2210496,"avatar_url":"https://avatars.githubusercontent.com/u/2210496?v=3","gravatar_id":"","url":"https://api.github.com/users/thatsIch","html_url":"https://github.com/thatsIch","followers_url":"https://api.github.com/users/thatsIch/followers","following_url":"https://api.github.com/users/thatsIch/following{/other_user}","gists_url":"https://api.github.com/users/thatsIch/gists{/gist_id}","starred_url":"https://api.github.com/users/thatsIch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thatsIch/subscriptions","organizations_url":"https://api.github.com/users/thatsIch/orgs","repos_url":"https://api.github.com/users/thatsIch/repos","events_url":"https://api.github.com/users/thatsIch/events{/privacy}","received_events_url":"https://api.github.com/users/thatsIch/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/pulls/1877/commits","review_comments_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/pulls/1877/comments","review_comment_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/issues/1877/comments","statuses_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/statuses/1121b11249aaece1aaa0e81009d01ed6c6ce52d4","head":{"label":"yueh:feature-itemlist-refactoring","ref":"feature-itemlist-refactoring","sha":"1121b11249aaece1aaa0e81009d01ed6c6ce52d4","user":{"login":"yueh","id":151949,"avatar_url":"https://avatars.githubusercontent.com/u/151949?v=3","gravatar_id":"","url":"https://api.github.com/users/yueh","html_url":"https://github.com/yueh","followers_url":"https://api.github.com/users/yueh/followers","following_url":"https://api.github.com/users/yueh/following{/other_user}","gists_url":"https://api.github.com/users/yueh/gists{/gist_id}","starred_url":"https://api.github.com/users/yueh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yueh/subscriptions","organizations_url":"https://api.github.com/users/yueh/orgs","repos_url":"https://api.github.com/users/yueh/repos","events_url":"https://api.github.com/users/yueh/events{/privacy}","received_events_url":"https://api.github.com/users/yueh/received_events","type":"User","site_admin":false},"repo":{"id":24421290,"name":"Applied-Energistics-2","full_name":"yueh/Applied-Energistics-2","owner":{"login":"yueh","id":151949,"avatar_url":"https://avatars.githubusercontent.com/u/151949?v=3","gravatar_id":"","url":"https://api.github.com/users/yueh","html_url":"https://github.com/yueh","followers_url":"https://api.github.com/users/yueh/followers","following_url":"https://api.github.com/users/yueh/following{/other_user}","gists_url":"https://api.github.com/users/yueh/gists{/gist_id}","starred_url":"https://api.github.com/users/yueh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yueh/subscriptions","organizations_url":"https://api.github.com/users/yueh/orgs","repos_url":"https://api.github.com/users/yueh/repos","events_url":"https://api.github.com/users/yueh/events{/privacy}","received_events_url":"https://api.github.com/users/yueh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yueh/Applied-Energistics-2","description":"A Mod about Matter, Energy and using them to conquer the world..","fork":true,"url":"https://api.github.com/repos/yueh/Applied-Energistics-2","forks_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/forks","keys_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/teams","hooks_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/hooks","issue_events_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/issues/events{/number}","events_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/events","assignees_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/assignees{/user}","branches_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/branches{/branch}","tags_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/tags","blobs_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/git/refs{/sha}","trees_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/statuses/{sha}","languages_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/languages","stargazers_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/stargazers","contributors_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/contributors","subscribers_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/subscribers","subscription_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/subscription","commits_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/commits{/sha}","git_commits_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/git/commits{/sha}","comments_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/comments{/number}","issue_comment_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/issues/comments{/number}","contents_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/contents/{+path}","compare_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/merges","archive_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/downloads","issues_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/issues{/number}","pulls_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/pulls{/number}","milestones_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/milestones{/number}","notifications_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/labels{/name}","releases_url":"https://api.github.com/repos/yueh/Applied-Energistics-2/releases{/id}","created_at":"2014-09-24T15:45:12Z","updated_at":"2015-04-28T16:29:30Z","pushed_at":"2015-09-22T20:44:53Z","git_url":"git://github.com/yueh/Applied-Energistics-2.git","ssh_url":"git@github.com:yueh/Applied-Energistics-2.git","clone_url":"https://github.com/yueh/Applied-Energistics-2.git","svn_url":"https://github.com/yueh/Applied-Energistics-2","homepage":"http://ae-mod.info/","size":12168,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"AppliedEnergistics:master","ref":"master","sha":"0df445c6a8a98c7fd2128161b128b6397ca19761","user":{"login":"AppliedEnergistics","id":8868712,"avatar_url":"https://avatars.githubusercontent.com/u/8868712?v=3","gravatar_id":"","url":"https://api.github.com/users/AppliedEnergistics","html_url":"https://github.com/AppliedEnergistics","followers_url":"https://api.github.com/users/AppliedEnergistics/followers","following_url":"https://api.github.com/users/AppliedEnergistics/following{/other_user}","gists_url":"https://api.github.com/users/AppliedEnergistics/gists{/gist_id}","starred_url":"https://api.github.com/users/AppliedEnergistics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AppliedEnergistics/subscriptions","organizations_url":"https://api.github.com/users/AppliedEnergistics/orgs","repos_url":"https://api.github.com/users/AppliedEnergistics/repos","events_url":"https://api.github.com/users/AppliedEnergistics/events{/privacy}","received_events_url":"https://api.github.com/users/AppliedEnergistics/received_events","type":"Organization","site_admin":false},"repo":{"id":24395109,"name":"Applied-Energistics-2","full_name":"AppliedEnergistics/Applied-Energistics-2","owner":{"login":"AppliedEnergistics","id":8868712,"avatar_url":"https://avatars.githubusercontent.com/u/8868712?v=3","gravatar_id":"","url":"https://api.github.com/users/AppliedEnergistics","html_url":"https://github.com/AppliedEnergistics","followers_url":"https://api.github.com/users/AppliedEnergistics/followers","following_url":"https://api.github.com/users/AppliedEnergistics/following{/other_user}","gists_url":"https://api.github.com/users/AppliedEnergistics/gists{/gist_id}","starred_url":"https://api.github.com/users/AppliedEnergistics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AppliedEnergistics/subscriptions","organizations_url":"https://api.github.com/users/AppliedEnergistics/orgs","repos_url":"https://api.github.com/users/AppliedEnergistics/repos","events_url":"https://api.github.com/users/AppliedEnergistics/events{/privacy}","received_events_url":"https://api.github.com/users/AppliedEnergistics/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AppliedEnergistics/Applied-Energistics-2","description":"A Minecraft Mod about Matter, Energy and using them to conquer the world..","fork":false,"url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2","forks_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/forks","keys_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/teams","hooks_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/hooks","issue_events_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/issues/events{/number}","events_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/events","assignees_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/assignees{/user}","branches_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/branches{/branch}","tags_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/tags","blobs_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/git/refs{/sha}","trees_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/statuses/{sha}","languages_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/languages","stargazers_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/stargazers","contributors_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/contributors","subscribers_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/subscribers","subscription_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/subscription","commits_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/commits{/sha}","git_commits_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/git/commits{/sha}","comments_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/comments{/number}","issue_comment_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/issues/comments{/number}","contents_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/contents/{+path}","compare_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/merges","archive_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/downloads","issues_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/issues{/number}","pulls_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/pulls{/number}","milestones_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/milestones{/number}","notifications_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/labels{/name}","releases_url":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/releases{/id}","created_at":"2014-09-24T00:48:40Z","updated_at":"2015-09-22T11:44:23Z","pushed_at":"2015-09-22T20:44:53Z","git_url":"git://github.com/AppliedEnergistics/Applied-Energistics-2.git","ssh_url":"git@github.com:AppliedEnergistics/Applied-Energistics-2.git","clone_url":"https://github.com/AppliedEnergistics/Applied-Energistics-2.git","svn_url":"https://github.com/AppliedEnergistics/Applied-Energistics-2","homepage":"http://ae-mod.info/","size":23923,"stargazers_count":275,"watchers_count":275,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":120,"mirror_url":null,"open_issues_count":235,"forks":120,"open_issues":235,"watchers":275,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/pulls/1877"},"html":{"href":"https://github.com/AppliedEnergistics/Applied-Energistics-2/pull/1877"},"issue":{"href":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/issues/1877"},"comments":{"href":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/issues/1877/comments"},"review_comments":{"href":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/pulls/1877/comments"},"review_comment":{"href":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/pulls/1877/commits"},"statuses":{"href":"https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/statuses/1121b11249aaece1aaa0e81009d01ed6c6ce52d4"}}}}