{"action":"created","comment":{"url":"https://api.github.com/repos/mana-ethereum/mana/pulls/comments/237316626","pull_request_review_id":179584845,"id":237316626,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNzMxNjYyNg==","diff_hunk":"@@ -233,7 +232,10 @@ defmodule Blockchain.Ethash do\n       |> initialize_mix(index, cache_size)\n       |> binary_into_uint32_list()\n \n-    uint32_cache = Enum.map(cache, &binary_into_uint32_list/1)\n+    uint32_cache =","path":"apps/blockchain/lib/blockchain/ethash.ex","position":44,"original_position":44,"commit_id":"0c2e87bd188802ad91af84cf6d2320375c48004c","original_commit_id":"0c2e87bd188802ad91af84cf6d2320375c48004c","user":{"login":"hayesgm","id":271024,"node_id":"MDQ6VXNlcjI3MTAyNA==","avatar_url":"https://avatars2.githubusercontent.com/u/271024?v=4","gravatar_id":"","url":"https://api.github.com/users/hayesgm","html_url":"https://github.com/hayesgm","followers_url":"https://api.github.com/users/hayesgm/followers","following_url":"https://api.github.com/users/hayesgm/following{/other_user}","gists_url":"https://api.github.com/users/hayesgm/gists{/gist_id}","starred_url":"https://api.github.com/users/hayesgm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hayesgm/subscriptions","organizations_url":"https://api.github.com/users/hayesgm/orgs","repos_url":"https://api.github.com/users/hayesgm/repos","events_url":"https://api.github.com/users/hayesgm/events{/privacy}","received_events_url":"https://api.github.com/users/hayesgm/received_events","type":"User","site_admin":false},"body":"This might also be a good place for `Enum.into/2` which does similar reduction logic","created_at":"2018-11-29T00:40:05Z","updated_at":"2018-11-29T00:42:27Z","html_url":"https://github.com/mana-ethereum/mana/pull/670#discussion_r237316626","pull_request_url":"https://api.github.com/repos/mana-ethereum/mana/pulls/670","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/mana-ethereum/mana/pulls/comments/237316626"},"html":{"href":"https://github.com/mana-ethereum/mana/pull/670#discussion_r237316626"},"pull_request":{"href":"https://api.github.com/repos/mana-ethereum/mana/pulls/670"}}},"pull_request":{"url":"https://api.github.com/repos/mana-ethereum/mana/pulls/670","id":234399218,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM0Mzk5MjE4","html_url":"https://github.com/mana-ethereum/mana/pull/670","diff_url":"https://github.com/mana-ethereum/mana/pull/670.diff","patch_url":"https://github.com/mana-ethereum/mana/pull/670.patch","issue_url":"https://api.github.com/repos/mana-ethereum/mana/issues/670","number":670,"state":"open","locked":false,"title":"Optimize Ethash proof-of-work","user":{"login":"germsvel","id":3245976,"node_id":"MDQ6VXNlcjMyNDU5NzY=","avatar_url":"https://avatars0.githubusercontent.com/u/3245976?v=4","gravatar_id":"","url":"https://api.github.com/users/germsvel","html_url":"https://github.com/germsvel","followers_url":"https://api.github.com/users/germsvel/followers","following_url":"https://api.github.com/users/germsvel/following{/other_user}","gists_url":"https://api.github.com/users/germsvel/gists{/gist_id}","starred_url":"https://api.github.com/users/germsvel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/germsvel/subscriptions","organizations_url":"https://api.github.com/users/germsvel/orgs","repos_url":"https://api.github.com/users/germsvel/repos","events_url":"https://api.github.com/users/germsvel/events{/privacy}","received_events_url":"https://api.github.com/users/germsvel/received_events","type":"User","site_admin":false},"body":"This is part of #541\r\n\r\nDescription\r\n===========\r\n\r\nUsing `Enum.at/2` is expensive with lists. We have been using lists throughout the Ethash module because the Yellow Paper and other implementations tend to use arrays. But since we have to access and update those lists constantly, we update the Cache to be a map with indexes for keys. This allows for faster reads and inserts.\r\n\r\nWhen profiling, we found that one of the hotspots was `FNV.hash_lists/2`. We update that function to no longer use `Enum.at` but to recursively walk through each pair of elements instead.\r\n\r\nProfiling\r\n======\r\n\r\nCNT: the total number of function calls that was found in the trace\r\nACC: time of the trace from first timestamp to last\r\nOWN: the sum of the execution time in functions found in the trace, not including called functions\r\n\r\nBefore\r\n\r\n![screen shot 2018-11-28 at 2 32 45 pm](https://user-images.githubusercontent.com/3245976/49177398-267a0e80-f31b-11e8-8d43-3604d7af72de.png)\r\n\r\nAfter\r\n\r\n![screen shot 2018-11-28 at 2 32 34 pm](https://user-images.githubusercontent.com/3245976/49177408-2e39b300-f31b-11e8-9ddd-92683ec51959.png)\r\n","created_at":"2018-11-28T19:36:49Z","updated_at":"2018-11-29T00:42:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dceb66715944485996ec3e87e815294ecd5a0d37","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":925629498,"node_id":"MDU6TGFiZWw5MjU2Mjk0OTg=","url":"https://api.github.com/repos/mana-ethereum/mana/labels/status:%20in%20progress","name":"status: in progress","color":"cccccc","default":false},{"id":925629513,"node_id":"MDU6TGFiZWw5MjU2Mjk1MTM=","url":"https://api.github.com/repos/mana-ethereum/mana/labels/status:%20review%20needed","name":"status: review needed","color":"fbca04","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/mana-ethereum/mana/pulls/670/commits","review_comments_url":"https://api.github.com/repos/mana-ethereum/mana/pulls/670/comments","review_comment_url":"https://api.github.com/repos/mana-ethereum/mana/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mana-ethereum/mana/issues/670/comments","statuses_url":"https://api.github.com/repos/mana-ethereum/mana/statuses/0c2e87bd188802ad91af84cf6d2320375c48004c","head":{"label":"mana-ethereum:gv-mms-pow-optimization","ref":"gv-mms-pow-optimization","sha":"0c2e87bd188802ad91af84cf6d2320375c48004c","user":{"login":"mana-ethereum","id":44409772,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ0NDA5Nzcy","avatar_url":"https://avatars2.githubusercontent.com/u/44409772?v=4","gravatar_id":"","url":"https://api.github.com/users/mana-ethereum","html_url":"https://github.com/mana-ethereum","followers_url":"https://api.github.com/users/mana-ethereum/followers","following_url":"https://api.github.com/users/mana-ethereum/following{/other_user}","gists_url":"https://api.github.com/users/mana-ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/mana-ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mana-ethereum/subscriptions","organizations_url":"https://api.github.com/users/mana-ethereum/orgs","repos_url":"https://api.github.com/users/mana-ethereum/repos","events_url":"https://api.github.com/users/mana-ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/mana-ethereum/received_events","type":"Organization","site_admin":false},"repo":{"id":129004779,"node_id":"MDEwOlJlcG9zaXRvcnkxMjkwMDQ3Nzk=","name":"mana","full_name":"mana-ethereum/mana","private":false,"owner":{"login":"mana-ethereum","id":44409772,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ0NDA5Nzcy","avatar_url":"https://avatars2.githubusercontent.com/u/44409772?v=4","gravatar_id":"","url":"https://api.github.com/users/mana-ethereum","html_url":"https://github.com/mana-ethereum","followers_url":"https://api.github.com/users/mana-ethereum/followers","following_url":"https://api.github.com/users/mana-ethereum/following{/other_user}","gists_url":"https://api.github.com/users/mana-ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/mana-ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mana-ethereum/subscriptions","organizations_url":"https://api.github.com/users/mana-ethereum/orgs","repos_url":"https://api.github.com/users/mana-ethereum/repos","events_url":"https://api.github.com/users/mana-ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/mana-ethereum/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/mana-ethereum/mana","description":"Ethereum full node implementation written in Elixir.","fork":false,"url":"https://api.github.com/repos/mana-ethereum/mana","forks_url":"https://api.github.com/repos/mana-ethereum/mana/forks","keys_url":"https://api.github.com/repos/mana-ethereum/mana/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mana-ethereum/mana/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mana-ethereum/mana/teams","hooks_url":"https://api.github.com/repos/mana-ethereum/mana/hooks","issue_events_url":"https://api.github.com/repos/mana-ethereum/mana/issues/events{/number}","events_url":"https://api.github.com/repos/mana-ethereum/mana/events","assignees_url":"https://api.github.com/repos/mana-ethereum/mana/assignees{/user}","branches_url":"https://api.github.com/repos/mana-ethereum/mana/branches{/branch}","tags_url":"https://api.github.com/repos/mana-ethereum/mana/tags","blobs_url":"https://api.github.com/repos/mana-ethereum/mana/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mana-ethereum/mana/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mana-ethereum/mana/git/refs{/sha}","trees_url":"https://api.github.com/repos/mana-ethereum/mana/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mana-ethereum/mana/statuses/{sha}","languages_url":"https://api.github.com/repos/mana-ethereum/mana/languages","stargazers_url":"https://api.github.com/repos/mana-ethereum/mana/stargazers","contributors_url":"https://api.github.com/repos/mana-ethereum/mana/contributors","subscribers_url":"https://api.github.com/repos/mana-ethereum/mana/subscribers","subscription_url":"https://api.github.com/repos/mana-ethereum/mana/subscription","commits_url":"https://api.github.com/repos/mana-ethereum/mana/commits{/sha}","git_commits_url":"https://api.github.com/repos/mana-ethereum/mana/git/commits{/sha}","comments_url":"https://api.github.com/repos/mana-ethereum/mana/comments{/number}","issue_comment_url":"https://api.github.com/repos/mana-ethereum/mana/issues/comments{/number}","contents_url":"https://api.github.com/repos/mana-ethereum/mana/contents/{+path}","compare_url":"https://api.github.com/repos/mana-ethereum/mana/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mana-ethereum/mana/merges","archive_url":"https://api.github.com/repos/mana-ethereum/mana/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mana-ethereum/mana/downloads","issues_url":"https://api.github.com/repos/mana-ethereum/mana/issues{/number}","pulls_url":"https://api.github.com/repos/mana-ethereum/mana/pulls{/number}","milestones_url":"https://api.github.com/repos/mana-ethereum/mana/milestones{/number}","notifications_url":"https://api.github.com/repos/mana-ethereum/mana/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mana-ethereum/mana/labels{/name}","releases_url":"https://api.github.com/repos/mana-ethereum/mana/releases{/id}","deployments_url":"https://api.github.com/repos/mana-ethereum/mana/deployments","created_at":"2018-04-10T23:04:46Z","updated_at":"2018-11-28T19:41:56Z","pushed_at":"2018-11-28T19:36:49Z","git_url":"git://github.com/mana-ethereum/mana.git","ssh_url":"git@github.com:mana-ethereum/mana.git","clone_url":"https://github.com/mana-ethereum/mana.git","svn_url":"https://github.com/mana-ethereum/mana","homepage":"","size":3830,"stargazers_count":151,"watchers_count":151,"language":"Elixir","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":24,"mirror_url":null,"archived":false,"open_issues_count":48,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":24,"open_issues":48,"watchers":151,"default_branch":"master"}},"base":{"label":"mana-ethereum:master","ref":"master","sha":"32af431538f0c2ac7cc80f3f674ce253b21e9e9e","user":{"login":"mana-ethereum","id":44409772,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ0NDA5Nzcy","avatar_url":"https://avatars2.githubusercontent.com/u/44409772?v=4","gravatar_id":"","url":"https://api.github.com/users/mana-ethereum","html_url":"https://github.com/mana-ethereum","followers_url":"https://api.github.com/users/mana-ethereum/followers","following_url":"https://api.github.com/users/mana-ethereum/following{/other_user}","gists_url":"https://api.github.com/users/mana-ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/mana-ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mana-ethereum/subscriptions","organizations_url":"https://api.github.com/users/mana-ethereum/orgs","repos_url":"https://api.github.com/users/mana-ethereum/repos","events_url":"https://api.github.com/users/mana-ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/mana-ethereum/received_events","type":"Organization","site_admin":false},"repo":{"id":129004779,"node_id":"MDEwOlJlcG9zaXRvcnkxMjkwMDQ3Nzk=","name":"mana","full_name":"mana-ethereum/mana","private":false,"owner":{"login":"mana-ethereum","id":44409772,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ0NDA5Nzcy","avatar_url":"https://avatars2.githubusercontent.com/u/44409772?v=4","gravatar_id":"","url":"https://api.github.com/users/mana-ethereum","html_url":"https://github.com/mana-ethereum","followers_url":"https://api.github.com/users/mana-ethereum/followers","following_url":"https://api.github.com/users/mana-ethereum/following{/other_user}","gists_url":"https://api.github.com/users/mana-ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/mana-ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mana-ethereum/subscriptions","organizations_url":"https://api.github.com/users/mana-ethereum/orgs","repos_url":"https://api.github.com/users/mana-ethereum/repos","events_url":"https://api.github.com/users/mana-ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/mana-ethereum/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/mana-ethereum/mana","description":"Ethereum full node implementation written in Elixir.","fork":false,"url":"https://api.github.com/repos/mana-ethereum/mana","forks_url":"https://api.github.com/repos/mana-ethereum/mana/forks","keys_url":"https://api.github.com/repos/mana-ethereum/mana/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mana-ethereum/mana/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mana-ethereum/mana/teams","hooks_url":"https://api.github.com/repos/mana-ethereum/mana/hooks","issue_events_url":"https://api.github.com/repos/mana-ethereum/mana/issues/events{/number}","events_url":"https://api.github.com/repos/mana-ethereum/mana/events","assignees_url":"https://api.github.com/repos/mana-ethereum/mana/assignees{/user}","branches_url":"https://api.github.com/repos/mana-ethereum/mana/branches{/branch}","tags_url":"https://api.github.com/repos/mana-ethereum/mana/tags","blobs_url":"https://api.github.com/repos/mana-ethereum/mana/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mana-ethereum/mana/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mana-ethereum/mana/git/refs{/sha}","trees_url":"https://api.github.com/repos/mana-ethereum/mana/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mana-ethereum/mana/statuses/{sha}","languages_url":"https://api.github.com/repos/mana-ethereum/mana/languages","stargazers_url":"https://api.github.com/repos/mana-ethereum/mana/stargazers","contributors_url":"https://api.github.com/repos/mana-ethereum/mana/contributors","subscribers_url":"https://api.github.com/repos/mana-ethereum/mana/subscribers","subscription_url":"https://api.github.com/repos/mana-ethereum/mana/subscription","commits_url":"https://api.github.com/repos/mana-ethereum/mana/commits{/sha}","git_commits_url":"https://api.github.com/repos/mana-ethereum/mana/git/commits{/sha}","comments_url":"https://api.github.com/repos/mana-ethereum/mana/comments{/number}","issue_comment_url":"https://api.github.com/repos/mana-ethereum/mana/issues/comments{/number}","contents_url":"https://api.github.com/repos/mana-ethereum/mana/contents/{+path}","compare_url":"https://api.github.com/repos/mana-ethereum/mana/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mana-ethereum/mana/merges","archive_url":"https://api.github.com/repos/mana-ethereum/mana/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mana-ethereum/mana/downloads","issues_url":"https://api.github.com/repos/mana-ethereum/mana/issues{/number}","pulls_url":"https://api.github.com/repos/mana-ethereum/mana/pulls{/number}","milestones_url":"https://api.github.com/repos/mana-ethereum/mana/milestones{/number}","notifications_url":"https://api.github.com/repos/mana-ethereum/mana/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mana-ethereum/mana/labels{/name}","releases_url":"https://api.github.com/repos/mana-ethereum/mana/releases{/id}","deployments_url":"https://api.github.com/repos/mana-ethereum/mana/deployments","created_at":"2018-04-10T23:04:46Z","updated_at":"2018-11-28T19:41:56Z","pushed_at":"2018-11-28T19:36:49Z","git_url":"git://github.com/mana-ethereum/mana.git","ssh_url":"git@github.com:mana-ethereum/mana.git","clone_url":"https://github.com/mana-ethereum/mana.git","svn_url":"https://github.com/mana-ethereum/mana","homepage":"","size":3830,"stargazers_count":151,"watchers_count":151,"language":"Elixir","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":24,"mirror_url":null,"archived":false,"open_issues_count":48,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":24,"open_issues":48,"watchers":151,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mana-ethereum/mana/pulls/670"},"html":{"href":"https://github.com/mana-ethereum/mana/pull/670"},"issue":{"href":"https://api.github.com/repos/mana-ethereum/mana/issues/670"},"comments":{"href":"https://api.github.com/repos/mana-ethereum/mana/issues/670/comments"},"review_comments":{"href":"https://api.github.com/repos/mana-ethereum/mana/pulls/670/comments"},"review_comment":{"href":"https://api.github.com/repos/mana-ethereum/mana/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mana-ethereum/mana/pulls/670/commits"},"statuses":{"href":"https://api.github.com/repos/mana-ethereum/mana/statuses/0c2e87bd188802ad91af84cf6d2320375c48004c"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"hayesgm"}}