{"action":"created","comment":{"url":"https://api.github.com/repos/javaslang/javaslang/pulls/comments/75482535","id":75482535,"diff_hunk":"@@ -561,20 +566,22 @@ private Vector(int indexShift, HashArrayMappedTrie<Integer, T> trie) {\n \n     @Override\n     public Vector<T> append(T element) {\n-        if (isEmpty()) {\n-            return of(element);\n-        } else {\n-            return new Vector<>(indexShift, trie.put(length() + indexShift, element));\n-        }\n+        return wrap(trie.appendLeaf(element));\n     }\n \n     @Override\n     public Vector<T> appendAll(Iterable<? extends T> elements) {\n-        HashArrayMappedTrie<Integer, T> result = trie;\n-        for (T element : elements) {\n-            result = result.put(result.size() + indexShift, element);\n+        Objects.requireNonNull(elements, \"elements is null\");\n+        if (isEmpty()) {\n+            return ofAll(elements);\n+        } else {\n+            Vector<T> result = this;\n+            for (T element : elements) {\n+                result = result.append(element);","path":"javaslang/src/main/java/javaslang/collection/Vector.java","position":99,"original_position":99,"commit_id":"dcc87bc47d9541d2e07e96cf42f174c23211a932","original_commit_id":"dcc87bc47d9541d2e07e96cf42f174c23211a932","user":{"login":"paplorinc","id":1841944,"avatar_url":"https://avatars.githubusercontent.com/u/1841944?v=3","gravatar_id":"","url":"https://api.github.com/users/paplorinc","html_url":"https://github.com/paplorinc","followers_url":"https://api.github.com/users/paplorinc/followers","following_url":"https://api.github.com/users/paplorinc/following{/other_user}","gists_url":"https://api.github.com/users/paplorinc/gists{/gist_id}","starred_url":"https://api.github.com/users/paplorinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paplorinc/subscriptions","organizations_url":"https://api.github.com/users/paplorinc/orgs","repos_url":"https://api.github.com/users/paplorinc/repos","events_url":"https://api.github.com/users/paplorinc/events{/privacy}","received_events_url":"https://api.github.com/users/paplorinc/received_events","type":"User","site_admin":false},"body":"Sure, that's how `create` worked previously also: https://github.com/javaslang/javaslang/pull/1449/commits/d0b782f386271cb2fa6c2dcc7d2bcbe2c79a57bc#diff-c6c1876105d111251f38e0916d4d99a4R24\r\n\r\ni.e. create the array locally, populate it, put it in the tree and don't keep any other references to it :)","created_at":"2016-08-19T13:38:55Z","updated_at":"2016-08-19T13:38:55Z","html_url":"https://github.com/javaslang/javaslang/pull/1504#discussion_r75482535","pull_request_url":"https://api.github.com/repos/javaslang/javaslang/pulls/1504","_links":{"self":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/comments/75482535"},"html":{"href":"https://github.com/javaslang/javaslang/pull/1504#discussion_r75482535"},"pull_request":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/1504"}}},"pull_request":{"url":"https://api.github.com/repos/javaslang/javaslang/pulls/1504","id":81690336,"html_url":"https://github.com/javaslang/javaslang/pull/1504","diff_url":"https://github.com/javaslang/javaslang/pull/1504.diff","patch_url":"https://github.com/javaslang/javaslang/pull/1504.patch","issue_url":"https://api.github.com/repos/javaslang/javaslang/issues/1504","number":1504,"state":"open","locked":false,"title":"Changed `Vector` from `HAMT` to `BMT`","user":{"login":"paplorinc","id":1841944,"avatar_url":"https://avatars.githubusercontent.com/u/1841944?v=3","gravatar_id":"","url":"https://api.github.com/users/paplorinc","html_url":"https://github.com/paplorinc","followers_url":"https://api.github.com/users/paplorinc/followers","following_url":"https://api.github.com/users/paplorinc/following{/other_user}","gists_url":"https://api.github.com/users/paplorinc/gists{/gist_id}","starred_url":"https://api.github.com/users/paplorinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paplorinc/subscriptions","organizations_url":"https://api.github.com/users/paplorinc/orgs","repos_url":"https://api.github.com/users/paplorinc/repos","events_url":"https://api.github.com/users/paplorinc/events{/privacy}","received_events_url":"https://api.github.com/users/paplorinc/received_events","type":"User","site_admin":false},"body":"Dependency for: https://github.com/javaslang/javaslang/pull/1449\r\n\r\nThis is the non-optimized version that I only compared to `Scala` for now, feel free to compare it against the [optimized version](https://github.com/javaslang/javaslang/pull/1449#issue-165953937).\r\n\r\nMemory:\r\n```java\r\nfor 32768 elements\r\n `scala.collection.immutable.Vector` uses `659 KB` (`20.7 KB` overhead, `0.6` bytes overhead per element)\r\n `javaslang.collection.Vector` uses `659 KB` (`20.6 KB` overhead, `0.6` bytes overhead per element)\r\n\r\nfor 1024 elements\r\n `scala.collection.immutable.Vector` uses `19.3 KB` (`672 bytes` overhead, `0.7` bytes overhead per element)\r\n `javaslang.collection.Vector` uses `19.3 KB` (`664 bytes` overhead, `0.6` bytes overhead per element)\r\n\r\nfor 32 elements\r\n `scala.collection.immutable.Vector` uses `536 bytes` (`32 bytes` overhead, `1.0` bytes overhead per element)\r\n `javaslang.collection.Vector` uses `528 bytes` (`24 bytes` overhead, `0.8` bytes overhead per element)\r\n```\r\n\r\nSpeed:\r\n```java\r\nOperation Ratio                                 32   1024  32768 \r\nCreate    slang_persistent/scala_persistent  0.33×  0.11×  0.07×\r\nHead      slang_persistent/scala_persistent  0.85×  0.64×  0.49×\r\nTail      slang_persistent/scala_persistent  1.04×  1.06×  0.96×\r\nGet       slang_persistent/scala_persistent  1.25×  1.10×  0.97×\r\nUpdate    slang_persistent/scala_persistent  1.04×  1.14×  1.24×\r\nPrepend   slang_persistent/scala_persistent  0.64×  0.58×  0.43×\r\nAppend    slang_persistent/scala_persistent  0.94×  0.37×  0.29×\r\nGroupBy   slang_persistent/scala_persistent  0.96×  0.31×  0.22×\r\nSlice     slang_persistent/scala_persistent  0.79×  1.23×  1.64×\r\nIterate   slang_persistent/scala_persistent  2.07×  1.08×  0.48×\r\n```\r\n\r\ni.e. for small number of elements it often has the same speed, for larger ones it's often `2-3x` slower.\r\nCompared to the optimized version this is roughly:\r\n* create: `~30x` slower\r\n* head: `~2x` slower\r\n* tail: `~4x` slower\r\n* get:  `~0.5x` slower (i.e. `~1.5x` faster)\r\n* update:  `~0.95x` slower (i.e. `~1.05x` faster)\r\n* prepend: `~2.5x` slower\r\n* append: `~2.5x` slower\r\n* groupby:  `~3.5x` slower\r\n* slice: `~3.5x` slower\r\n* iterate: `~2x` slower","created_at":"2016-08-17T18:14:34Z","updated_at":"2016-08-19T13:38:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"73d370ff009e1d5f58bbc1813ca335a0b94059db","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/javaslang/javaslang/milestones/20","html_url":"https://github.com/javaslang/javaslang/milestones/2.1.0","labels_url":"https://api.github.com/repos/javaslang/javaslang/milestones/20/labels","id":1294243,"number":20,"title":"2.1.0","description":"Boost up collection performance","creator":{"login":"danieldietrich","id":743833,"avatar_url":"https://avatars.githubusercontent.com/u/743833?v=3","gravatar_id":"","url":"https://api.github.com/users/danieldietrich","html_url":"https://github.com/danieldietrich","followers_url":"https://api.github.com/users/danieldietrich/followers","following_url":"https://api.github.com/users/danieldietrich/following{/other_user}","gists_url":"https://api.github.com/users/danieldietrich/gists{/gist_id}","starred_url":"https://api.github.com/users/danieldietrich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danieldietrich/subscriptions","organizations_url":"https://api.github.com/users/danieldietrich/orgs","repos_url":"https://api.github.com/users/danieldietrich/repos","events_url":"https://api.github.com/users/danieldietrich/events{/privacy}","received_events_url":"https://api.github.com/users/danieldietrich/received_events","type":"User","site_admin":false},"open_issues":74,"closed_issues":215,"state":"open","created_at":"2015-09-07T18:46:28Z","updated_at":"2016-08-19T09:51:55Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/javaslang/javaslang/pulls/1504/commits","review_comments_url":"https://api.github.com/repos/javaslang/javaslang/pulls/1504/comments","review_comment_url":"https://api.github.com/repos/javaslang/javaslang/pulls/comments{/number}","comments_url":"https://api.github.com/repos/javaslang/javaslang/issues/1504/comments","statuses_url":"https://api.github.com/repos/javaslang/javaslang/statuses/dcc87bc47d9541d2e07e96cf42f174c23211a932","head":{"label":"paplorinc:NewVector","ref":"NewVector","sha":"dcc87bc47d9541d2e07e96cf42f174c23211a932","user":{"login":"paplorinc","id":1841944,"avatar_url":"https://avatars.githubusercontent.com/u/1841944?v=3","gravatar_id":"","url":"https://api.github.com/users/paplorinc","html_url":"https://github.com/paplorinc","followers_url":"https://api.github.com/users/paplorinc/followers","following_url":"https://api.github.com/users/paplorinc/following{/other_user}","gists_url":"https://api.github.com/users/paplorinc/gists{/gist_id}","starred_url":"https://api.github.com/users/paplorinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paplorinc/subscriptions","organizations_url":"https://api.github.com/users/paplorinc/orgs","repos_url":"https://api.github.com/users/paplorinc/repos","events_url":"https://api.github.com/users/paplorinc/events{/privacy}","received_events_url":"https://api.github.com/users/paplorinc/received_events","type":"User","site_admin":false},"repo":{"id":55842829,"name":"javaslang","full_name":"paplorinc/javaslang","owner":{"login":"paplorinc","id":1841944,"avatar_url":"https://avatars.githubusercontent.com/u/1841944?v=3","gravatar_id":"","url":"https://api.github.com/users/paplorinc","html_url":"https://github.com/paplorinc","followers_url":"https://api.github.com/users/paplorinc/followers","following_url":"https://api.github.com/users/paplorinc/following{/other_user}","gists_url":"https://api.github.com/users/paplorinc/gists{/gist_id}","starred_url":"https://api.github.com/users/paplorinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paplorinc/subscriptions","organizations_url":"https://api.github.com/users/paplorinc/orgs","repos_url":"https://api.github.com/users/paplorinc/repos","events_url":"https://api.github.com/users/paplorinc/events{/privacy}","received_events_url":"https://api.github.com/users/paplorinc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/paplorinc/javaslang","description":"A functional library for Java 8+ that provides persistent data types and functional control structures.","fork":true,"url":"https://api.github.com/repos/paplorinc/javaslang","forks_url":"https://api.github.com/repos/paplorinc/javaslang/forks","keys_url":"https://api.github.com/repos/paplorinc/javaslang/keys{/key_id}","collaborators_url":"https://api.github.com/repos/paplorinc/javaslang/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/paplorinc/javaslang/teams","hooks_url":"https://api.github.com/repos/paplorinc/javaslang/hooks","issue_events_url":"https://api.github.com/repos/paplorinc/javaslang/issues/events{/number}","events_url":"https://api.github.com/repos/paplorinc/javaslang/events","assignees_url":"https://api.github.com/repos/paplorinc/javaslang/assignees{/user}","branches_url":"https://api.github.com/repos/paplorinc/javaslang/branches{/branch}","tags_url":"https://api.github.com/repos/paplorinc/javaslang/tags","blobs_url":"https://api.github.com/repos/paplorinc/javaslang/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/paplorinc/javaslang/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/paplorinc/javaslang/git/refs{/sha}","trees_url":"https://api.github.com/repos/paplorinc/javaslang/git/trees{/sha}","statuses_url":"https://api.github.com/repos/paplorinc/javaslang/statuses/{sha}","languages_url":"https://api.github.com/repos/paplorinc/javaslang/languages","stargazers_url":"https://api.github.com/repos/paplorinc/javaslang/stargazers","contributors_url":"https://api.github.com/repos/paplorinc/javaslang/contributors","subscribers_url":"https://api.github.com/repos/paplorinc/javaslang/subscribers","subscription_url":"https://api.github.com/repos/paplorinc/javaslang/subscription","commits_url":"https://api.github.com/repos/paplorinc/javaslang/commits{/sha}","git_commits_url":"https://api.github.com/repos/paplorinc/javaslang/git/commits{/sha}","comments_url":"https://api.github.com/repos/paplorinc/javaslang/comments{/number}","issue_comment_url":"https://api.github.com/repos/paplorinc/javaslang/issues/comments{/number}","contents_url":"https://api.github.com/repos/paplorinc/javaslang/contents/{+path}","compare_url":"https://api.github.com/repos/paplorinc/javaslang/compare/{base}...{head}","merges_url":"https://api.github.com/repos/paplorinc/javaslang/merges","archive_url":"https://api.github.com/repos/paplorinc/javaslang/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/paplorinc/javaslang/downloads","issues_url":"https://api.github.com/repos/paplorinc/javaslang/issues{/number}","pulls_url":"https://api.github.com/repos/paplorinc/javaslang/pulls{/number}","milestones_url":"https://api.github.com/repos/paplorinc/javaslang/milestones{/number}","notifications_url":"https://api.github.com/repos/paplorinc/javaslang/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/paplorinc/javaslang/labels{/name}","releases_url":"https://api.github.com/repos/paplorinc/javaslang/releases{/id}","deployments_url":"https://api.github.com/repos/paplorinc/javaslang/deployments","created_at":"2016-04-09T12:20:36Z","updated_at":"2016-04-09T12:20:39Z","pushed_at":"2016-08-19T08:59:10Z","git_url":"git://github.com/paplorinc/javaslang.git","ssh_url":"git@github.com:paplorinc/javaslang.git","clone_url":"https://github.com/paplorinc/javaslang.git","svn_url":"https://github.com/paplorinc/javaslang","homepage":"http://javaslang.io","size":12570,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"javaslang:master","ref":"master","sha":"f383240ee27b12a156ef6cfd554d0fd5e8a85e3f","user":{"login":"javaslang","id":5786132,"avatar_url":"https://avatars.githubusercontent.com/u/5786132?v=3","gravatar_id":"","url":"https://api.github.com/users/javaslang","html_url":"https://github.com/javaslang","followers_url":"https://api.github.com/users/javaslang/followers","following_url":"https://api.github.com/users/javaslang/following{/other_user}","gists_url":"https://api.github.com/users/javaslang/gists{/gist_id}","starred_url":"https://api.github.com/users/javaslang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javaslang/subscriptions","organizations_url":"https://api.github.com/users/javaslang/orgs","repos_url":"https://api.github.com/users/javaslang/repos","events_url":"https://api.github.com/users/javaslang/events{/privacy}","received_events_url":"https://api.github.com/users/javaslang/received_events","type":"Organization","site_admin":false},"repo":{"id":16378879,"name":"javaslang","full_name":"javaslang/javaslang","owner":{"login":"javaslang","id":5786132,"avatar_url":"https://avatars.githubusercontent.com/u/5786132?v=3","gravatar_id":"","url":"https://api.github.com/users/javaslang","html_url":"https://github.com/javaslang","followers_url":"https://api.github.com/users/javaslang/followers","following_url":"https://api.github.com/users/javaslang/following{/other_user}","gists_url":"https://api.github.com/users/javaslang/gists{/gist_id}","starred_url":"https://api.github.com/users/javaslang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javaslang/subscriptions","organizations_url":"https://api.github.com/users/javaslang/orgs","repos_url":"https://api.github.com/users/javaslang/repos","events_url":"https://api.github.com/users/javaslang/events{/privacy}","received_events_url":"https://api.github.com/users/javaslang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/javaslang/javaslang","description":"A functional library for Java 8+ that provides persistent data types and functional control structures.","fork":false,"url":"https://api.github.com/repos/javaslang/javaslang","forks_url":"https://api.github.com/repos/javaslang/javaslang/forks","keys_url":"https://api.github.com/repos/javaslang/javaslang/keys{/key_id}","collaborators_url":"https://api.github.com/repos/javaslang/javaslang/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/javaslang/javaslang/teams","hooks_url":"https://api.github.com/repos/javaslang/javaslang/hooks","issue_events_url":"https://api.github.com/repos/javaslang/javaslang/issues/events{/number}","events_url":"https://api.github.com/repos/javaslang/javaslang/events","assignees_url":"https://api.github.com/repos/javaslang/javaslang/assignees{/user}","branches_url":"https://api.github.com/repos/javaslang/javaslang/branches{/branch}","tags_url":"https://api.github.com/repos/javaslang/javaslang/tags","blobs_url":"https://api.github.com/repos/javaslang/javaslang/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/javaslang/javaslang/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/javaslang/javaslang/git/refs{/sha}","trees_url":"https://api.github.com/repos/javaslang/javaslang/git/trees{/sha}","statuses_url":"https://api.github.com/repos/javaslang/javaslang/statuses/{sha}","languages_url":"https://api.github.com/repos/javaslang/javaslang/languages","stargazers_url":"https://api.github.com/repos/javaslang/javaslang/stargazers","contributors_url":"https://api.github.com/repos/javaslang/javaslang/contributors","subscribers_url":"https://api.github.com/repos/javaslang/javaslang/subscribers","subscription_url":"https://api.github.com/repos/javaslang/javaslang/subscription","commits_url":"https://api.github.com/repos/javaslang/javaslang/commits{/sha}","git_commits_url":"https://api.github.com/repos/javaslang/javaslang/git/commits{/sha}","comments_url":"https://api.github.com/repos/javaslang/javaslang/comments{/number}","issue_comment_url":"https://api.github.com/repos/javaslang/javaslang/issues/comments{/number}","contents_url":"https://api.github.com/repos/javaslang/javaslang/contents/{+path}","compare_url":"https://api.github.com/repos/javaslang/javaslang/compare/{base}...{head}","merges_url":"https://api.github.com/repos/javaslang/javaslang/merges","archive_url":"https://api.github.com/repos/javaslang/javaslang/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/javaslang/javaslang/downloads","issues_url":"https://api.github.com/repos/javaslang/javaslang/issues{/number}","pulls_url":"https://api.github.com/repos/javaslang/javaslang/pulls{/number}","milestones_url":"https://api.github.com/repos/javaslang/javaslang/milestones{/number}","notifications_url":"https://api.github.com/repos/javaslang/javaslang/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/javaslang/javaslang/labels{/name}","releases_url":"https://api.github.com/repos/javaslang/javaslang/releases{/id}","deployments_url":"https://api.github.com/repos/javaslang/javaslang/deployments","created_at":"2014-01-30T14:07:25Z","updated_at":"2016-08-19T11:09:34Z","pushed_at":"2016-08-19T08:59:11Z","git_url":"git://github.com/javaslang/javaslang.git","ssh_url":"git@github.com:javaslang/javaslang.git","clone_url":"https://github.com/javaslang/javaslang.git","svn_url":"https://github.com/javaslang/javaslang","homepage":"http://javaslang.io","size":14132,"stargazers_count":1096,"watchers_count":1096,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":125,"mirror_url":null,"open_issues_count":114,"forks":125,"open_issues":114,"watchers":1096,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/1504"},"html":{"href":"https://github.com/javaslang/javaslang/pull/1504"},"issue":{"href":"https://api.github.com/repos/javaslang/javaslang/issues/1504"},"comments":{"href":"https://api.github.com/repos/javaslang/javaslang/issues/1504/comments"},"review_comments":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/1504/comments"},"review_comment":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/1504/commits"},"statuses":{"href":"https://api.github.com/repos/javaslang/javaslang/statuses/dcc87bc47d9541d2e07e96cf42f174c23211a932"}}}}
{"actor":{"display_login":"paplorinc"}}