{"action":"opened","number":1035,"pull_request":{"url":"https://api.github.com/repos/opal/opal/pulls/1035","id":41399446,"html_url":"https://github.com/opal/opal/pull/1035","diff_url":"https://github.com/opal/opal/pull/1035.diff","patch_url":"https://github.com/opal/opal/pull/1035.patch","issue_url":"https://api.github.com/repos/opal/opal/issues/1035","number":1035,"state":"open","locked":false,"title":"Hash redux","user":{"login":"vais","id":77592,"avatar_url":"https://avatars.githubusercontent.com/u/77592?v=3","gravatar_id":"","url":"https://api.github.com/users/vais","html_url":"https://github.com/vais","followers_url":"https://api.github.com/users/vais/followers","following_url":"https://api.github.com/users/vais/following{/other_user}","gists_url":"https://api.github.com/users/vais/gists{/gist_id}","starred_url":"https://api.github.com/users/vais/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vais/subscriptions","organizations_url":"https://api.github.com/users/vais/orgs","repos_url":"https://api.github.com/users/vais/repos","events_url":"https://api.github.com/users/vais/events{/privacy}","received_events_url":"https://api.github.com/users/vais/received_events","type":"User","site_admin":false},"body":"These changes to `Hash` internals are explained in `spec/opal/core/hash/internals_spec.rb`\r\n\r\nPerformance-wise, `Opal1` below is running under the current master, `Opal2` is after the changes. As usual, `Ruby1` represents the same benchmarks running under MRI (ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]) provided as a base line/reference.\r\n\r\nMaking sure that the most common case for hashes (hashes with symbol/string keys) is not negatively impacted was a major consideration while making these changes.\r\n\r\nE.g. `bm_hash_literal_string_*` below tests the performance for hash literals.\r\n```\r\n$ bundle exec rake bench:report\r\nBenchmark                             Opal1   Opal2  Ruby1\r\nbm_hash_assoc_object.rb               0.674   0.835  0.015\r\nbm_hash_assoc_string.rb               2.875   2.783  0.012\r\nbm_hash_clone_object.rb               1.924   1.731  0.671\r\nbm_hash_clone_string.rb               0.168   0.336  0.749\r\nbm_hash_delete_object.rb              0.738   0.146  0.018\r\nbm_hash_delete_string.rb              2.955   0.029  0.008\r\nbm_hash_each_key_object.rb            0.162   0.245  1.259\r\nbm_hash_each_key_string.rb            0.143   0.162  0.852\r\nbm_hash_each_object.rb                7.058   0.838  1.164\r\nbm_hash_each_string.rb                0.812   0.860  0.928\r\nbm_hash_each_value_object.rb          5.769   0.266  1.149\r\nbm_hash_each_value_string.rb          0.204   0.204  0.847\r\nbm_hash_element_reference_object.rb   0.109   0.209  0.017\r\nbm_hash_element_reference_string.rb   0.016   0.020  0.013\r\nbm_hash_element_set_object.rb         0.397   0.765  0.121\r\nbm_hash_element_set_string.rb         0.137   0.135  0.067\r\nbm_hash_equal_value_object.rb        12.652   9.508  3.091\r\nbm_hash_equal_value_string.rb         2.387   0.209  1.204\r\nbm_hash_fetch_object.rb               0.098   0.113  0.011\r\nbm_hash_fetch_string.rb               0.013   0.014  0.013\r\nbm_hash_flatten_object.rb             6.423   0.208  0.775\r\nbm_hash_flatten_string.rb             0.240   0.249  0.678\r\nbm_hash_has_key_object.rb            11.211   0.124  0.013\r\nbm_hash_has_key_string.rb            13.989   0.019  0.007\r\nbm_hash_has_value_object.rb           0.735   0.232  0.095\r\nbm_hash_has_value_string.rb           0.118   0.121  0.044\r\nbm_hash_hash_object.rb                2.297   2.118  0.042\r\nbm_hash_hash_string.rb                1.865   1.858  0.045\r\nbm_hash_inspect_object.rb             3.413   1.933  3.006\r\nbm_hash_inspect_string.rb             1.363   1.424  0.923\r\nbm_hash_invert_object.rb              2.657   0.781  0.097\r\nbm_hash_invert_string.rb              0.973   0.762  0.070\r\nbm_hash_keep_if_object.rb             8.114   2.941  0.522\r\nbm_hash_keep_if_string.rb             3.156   3.153  0.498\r\nbm_hash_key_object.rb                 0.441   0.165  0.099\r\nbm_hash_key_string.rb                 0.118   0.116  0.050\r\nbm_hash_keys_object.rb                0.101   0.353  0.328\r\nbm_hash_keys_string.rb                0.073   0.230  0.525\r\nbm_hash_literal_mixed_large.rb        2.453   3.058  0.557\r\nbm_hash_literal_mixed_small.rb        0.879   0.953  0.058\r\nbm_hash_literal_object_large.rb       3.797   4.682  0.724\r\nbm_hash_literal_object_small.rb       1.040   1.190  0.065\r\nbm_hash_literal_string_large.rb       0.050   0.048  3.735\r\nbm_hash_literal_string_small.rb       0.018   0.017  0.314\r\nbm_hash_merge_object.rb               9.815  12.055  2.569\r\nbm_hash_merge_string.rb               0.710   1.735  0.935\r\nbm_hash_rassoc_object.rb              0.953   0.147  0.077\r\nbm_hash_rassoc_string.rb              0.117   0.124  0.052\r\nbm_hash_reject_object.rb              6.581   2.450  0.380\r\nbm_hash_reject_string.rb              0.776   1.145  0.284\r\nbm_hash_replace_object.rb             7.399  11.178  2.851\r\nbm_hash_replace_string.rb             0.805   1.843  1.605\r\nbm_hash_select_bang_object.rb        34.367   1.652  5.126\r\nbm_hash_select_bang_string.rb         1.712   1.710  4.431\r\nbm_hash_select_object.rb              2.631   5.149  0.353\r\nbm_hash_select_string.rb              0.910   1.037  0.346\r\nbm_hash_shift_object.rb               5.228   6.834  0.987\r\nbm_hash_shift_string.rb               1.724   1.842  0.446\r\nbm_hash_to_a_object.rb               31.863   1.011  6.587\r\nbm_hash_to_a_string.rb                1.341   1.379  5.287\r\nbm_hash_to_h_object.rb               16.200  22.642  2.482\r\nbm_hash_to_h_string.rb                1.423   3.510  2.575\r\nbm_hash_values_object.rb              8.107   0.145  0.131\r\nbm_hash_values_string.rb              0.196   0.185  0.080\r\n```\r\n:beers: ","created_at":"2015-08-01T09:38:28Z","updated_at":"2015-08-01T09:38:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/opal/opal/pulls/1035/commits","review_comments_url":"https://api.github.com/repos/opal/opal/pulls/1035/comments","review_comment_url":"https://api.github.com/repos/opal/opal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opal/opal/issues/1035/comments","statuses_url":"https://api.github.com/repos/opal/opal/statuses/bd61c41ebeb59885ac9d325141e4ca0c0b920c13","head":{"label":"vais:hash","ref":"hash","sha":"bd61c41ebeb59885ac9d325141e4ca0c0b920c13","user":{"login":"vais","id":77592,"avatar_url":"https://avatars.githubusercontent.com/u/77592?v=3","gravatar_id":"","url":"https://api.github.com/users/vais","html_url":"https://github.com/vais","followers_url":"https://api.github.com/users/vais/followers","following_url":"https://api.github.com/users/vais/following{/other_user}","gists_url":"https://api.github.com/users/vais/gists{/gist_id}","starred_url":"https://api.github.com/users/vais/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vais/subscriptions","organizations_url":"https://api.github.com/users/vais/orgs","repos_url":"https://api.github.com/users/vais/repos","events_url":"https://api.github.com/users/vais/events{/privacy}","received_events_url":"https://api.github.com/users/vais/received_events","type":"User","site_admin":false},"repo":{"id":30140782,"name":"opal","full_name":"vais/opal","owner":{"login":"vais","id":77592,"avatar_url":"https://avatars.githubusercontent.com/u/77592?v=3","gravatar_id":"","url":"https://api.github.com/users/vais","html_url":"https://github.com/vais","followers_url":"https://api.github.com/users/vais/followers","following_url":"https://api.github.com/users/vais/following{/other_user}","gists_url":"https://api.github.com/users/vais/gists{/gist_id}","starred_url":"https://api.github.com/users/vais/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vais/subscriptions","organizations_url":"https://api.github.com/users/vais/orgs","repos_url":"https://api.github.com/users/vais/repos","events_url":"https://api.github.com/users/vais/events{/privacy}","received_events_url":"https://api.github.com/users/vais/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vais/opal","description":"Ruby to Javascript compiler","fork":true,"url":"https://api.github.com/repos/vais/opal","forks_url":"https://api.github.com/repos/vais/opal/forks","keys_url":"https://api.github.com/repos/vais/opal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vais/opal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vais/opal/teams","hooks_url":"https://api.github.com/repos/vais/opal/hooks","issue_events_url":"https://api.github.com/repos/vais/opal/issues/events{/number}","events_url":"https://api.github.com/repos/vais/opal/events","assignees_url":"https://api.github.com/repos/vais/opal/assignees{/user}","branches_url":"https://api.github.com/repos/vais/opal/branches{/branch}","tags_url":"https://api.github.com/repos/vais/opal/tags","blobs_url":"https://api.github.com/repos/vais/opal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vais/opal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vais/opal/git/refs{/sha}","trees_url":"https://api.github.com/repos/vais/opal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vais/opal/statuses/{sha}","languages_url":"https://api.github.com/repos/vais/opal/languages","stargazers_url":"https://api.github.com/repos/vais/opal/stargazers","contributors_url":"https://api.github.com/repos/vais/opal/contributors","subscribers_url":"https://api.github.com/repos/vais/opal/subscribers","subscription_url":"https://api.github.com/repos/vais/opal/subscription","commits_url":"https://api.github.com/repos/vais/opal/commits{/sha}","git_commits_url":"https://api.github.com/repos/vais/opal/git/commits{/sha}","comments_url":"https://api.github.com/repos/vais/opal/comments{/number}","issue_comment_url":"https://api.github.com/repos/vais/opal/issues/comments{/number}","contents_url":"https://api.github.com/repos/vais/opal/contents/{+path}","compare_url":"https://api.github.com/repos/vais/opal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vais/opal/merges","archive_url":"https://api.github.com/repos/vais/opal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vais/opal/downloads","issues_url":"https://api.github.com/repos/vais/opal/issues{/number}","pulls_url":"https://api.github.com/repos/vais/opal/pulls{/number}","milestones_url":"https://api.github.com/repos/vais/opal/milestones{/number}","notifications_url":"https://api.github.com/repos/vais/opal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vais/opal/labels{/name}","releases_url":"https://api.github.com/repos/vais/opal/releases{/id}","created_at":"2015-02-01T08:29:46Z","updated_at":"2015-05-07T23:01:15Z","pushed_at":"2015-08-01T09:15:28Z","git_url":"git://github.com/vais/opal.git","ssh_url":"git@github.com:vais/opal.git","clone_url":"https://github.com/vais/opal.git","svn_url":"https://github.com/vais/opal","homepage":"http://opalrb.org","size":10533,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"opal:master","ref":"master","sha":"94a1019f9c1e219369ecef6cc83299176bc573ff","user":{"login":"opal","id":842643,"avatar_url":"https://avatars.githubusercontent.com/u/842643?v=3","gravatar_id":"","url":"https://api.github.com/users/opal","html_url":"https://github.com/opal","followers_url":"https://api.github.com/users/opal/followers","following_url":"https://api.github.com/users/opal/following{/other_user}","gists_url":"https://api.github.com/users/opal/gists{/gist_id}","starred_url":"https://api.github.com/users/opal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opal/subscriptions","organizations_url":"https://api.github.com/users/opal/orgs","repos_url":"https://api.github.com/users/opal/repos","events_url":"https://api.github.com/users/opal/events{/privacy}","received_events_url":"https://api.github.com/users/opal/received_events","type":"Organization","site_admin":false},"repo":{"id":184366,"name":"opal","full_name":"opal/opal","owner":{"login":"opal","id":842643,"avatar_url":"https://avatars.githubusercontent.com/u/842643?v=3","gravatar_id":"","url":"https://api.github.com/users/opal","html_url":"https://github.com/opal","followers_url":"https://api.github.com/users/opal/followers","following_url":"https://api.github.com/users/opal/following{/other_user}","gists_url":"https://api.github.com/users/opal/gists{/gist_id}","starred_url":"https://api.github.com/users/opal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opal/subscriptions","organizations_url":"https://api.github.com/users/opal/orgs","repos_url":"https://api.github.com/users/opal/repos","events_url":"https://api.github.com/users/opal/events{/privacy}","received_events_url":"https://api.github.com/users/opal/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/opal/opal","description":"Ruby to JavaScript compiler","fork":false,"url":"https://api.github.com/repos/opal/opal","forks_url":"https://api.github.com/repos/opal/opal/forks","keys_url":"https://api.github.com/repos/opal/opal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opal/opal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opal/opal/teams","hooks_url":"https://api.github.com/repos/opal/opal/hooks","issue_events_url":"https://api.github.com/repos/opal/opal/issues/events{/number}","events_url":"https://api.github.com/repos/opal/opal/events","assignees_url":"https://api.github.com/repos/opal/opal/assignees{/user}","branches_url":"https://api.github.com/repos/opal/opal/branches{/branch}","tags_url":"https://api.github.com/repos/opal/opal/tags","blobs_url":"https://api.github.com/repos/opal/opal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opal/opal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opal/opal/git/refs{/sha}","trees_url":"https://api.github.com/repos/opal/opal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opal/opal/statuses/{sha}","languages_url":"https://api.github.com/repos/opal/opal/languages","stargazers_url":"https://api.github.com/repos/opal/opal/stargazers","contributors_url":"https://api.github.com/repos/opal/opal/contributors","subscribers_url":"https://api.github.com/repos/opal/opal/subscribers","subscription_url":"https://api.github.com/repos/opal/opal/subscription","commits_url":"https://api.github.com/repos/opal/opal/commits{/sha}","git_commits_url":"https://api.github.com/repos/opal/opal/git/commits{/sha}","comments_url":"https://api.github.com/repos/opal/opal/comments{/number}","issue_comment_url":"https://api.github.com/repos/opal/opal/issues/comments{/number}","contents_url":"https://api.github.com/repos/opal/opal/contents/{+path}","compare_url":"https://api.github.com/repos/opal/opal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opal/opal/merges","archive_url":"https://api.github.com/repos/opal/opal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opal/opal/downloads","issues_url":"https://api.github.com/repos/opal/opal/issues{/number}","pulls_url":"https://api.github.com/repos/opal/opal/pulls{/number}","milestones_url":"https://api.github.com/repos/opal/opal/milestones{/number}","notifications_url":"https://api.github.com/repos/opal/opal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opal/opal/labels{/name}","releases_url":"https://api.github.com/repos/opal/opal/releases{/id}","created_at":"2009-04-24T08:53:34Z","updated_at":"2015-08-01T00:57:45Z","pushed_at":"2015-07-30T17:32:23Z","git_url":"git://github.com/opal/opal.git","ssh_url":"git@github.com:opal/opal.git","clone_url":"https://github.com/opal/opal.git","svn_url":"https://github.com/opal/opal","homepage":"http://opalrb.org","size":21468,"stargazers_count":2778,"watchers_count":2778,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":186,"mirror_url":null,"open_issues_count":132,"forks":186,"open_issues":132,"watchers":2778,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/opal/opal/pulls/1035"},"html":{"href":"https://github.com/opal/opal/pull/1035"},"issue":{"href":"https://api.github.com/repos/opal/opal/issues/1035"},"comments":{"href":"https://api.github.com/repos/opal/opal/issues/1035/comments"},"review_comments":{"href":"https://api.github.com/repos/opal/opal/pulls/1035/comments"},"review_comment":{"href":"https://api.github.com/repos/opal/opal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opal/opal/pulls/1035/commits"},"statuses":{"href":"https://api.github.com/repos/opal/opal/statuses/bd61c41ebeb59885ac9d325141e4ca0c0b920c13"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":1575,"deletions":716,"changed_files":77}}