{"action":"created","comment":{"url":"https://api.github.com/repos/javaslang/javaslang/pulls/comments/77458602","id":77458602,"diff_hunk":"@@ -164,14 +164,21 @@ private Vector(BitMappedTrie<T> trie) {\n         if (elements instanceof Vector) {\n             return (Vector<T>) elements;\n         } else {\n-            BitMappedTrie<T> trie = BitMappedTrie.empty();\n-            for (T element : elements) {\n-                trie = trie.append(element);\n-            }\n-            return ofAll(trie);\n+            final Seq<? extends T> seq = seq(elements);\n+            return ofAll(seq, seq.size());\n         }\n     }\n \n+    public static <T> Vector<T> ofAll(Collection<? extends T> elements) {\n+        Objects.requireNonNull(elements, \"elements is null\");\n+        return ofAll(elements, elements.size());\n+    }\n+\n+    public static <T> Vector<T> ofAll(Iterable<? extends T> iterable, int size) {","path":"javaslang/src/main/java/javaslang/collection/Vector.java","position":null,"original_position":19,"commit_id":"a8a847cc39db66f2c17482f74c3719a8a016d412","original_commit_id":"274cffde1ec41d80adf35e8d3144b950f29c392c","user":{"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},"body":"Why do we need this public method? The user should not be bothered providing a size, right? If it is needed internally I would reduce the visibility.","created_at":"2016-09-04T21:04:25Z","updated_at":"2016-09-04T21:04:25Z","html_url":"https://github.com/javaslang/javaslang/pull/1522#discussion_r77458602","pull_request_url":"https://api.github.com/repos/javaslang/javaslang/pulls/1522","_links":{"self":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/comments/77458602"},"html":{"href":"https://github.com/javaslang/javaslang/pull/1522#discussion_r77458602"},"pull_request":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/1522"}}},"pull_request":{"url":"https://api.github.com/repos/javaslang/javaslang/pulls/1522","id":82370191,"html_url":"https://github.com/javaslang/javaslang/pull/1522","diff_url":"https://github.com/javaslang/javaslang/pull/1522.diff","patch_url":"https://github.com/javaslang/javaslang/pull/1522.patch","issue_url":"https://api.github.com/repos/javaslang/javaslang/issues/1522","number":1522,"state":"open","locked":false,"title":"Vector optimizations","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":"Optimizes #1504\r\n\r\nEvery commit introduces a new type of optimization, i.e. \r\n* **Optimized `ofAll` for `Vector`**\r\n  * `~90×` faster by building the tree from bottom up\r\n* **Optimized `prepend` and `append` for `Vector`**\r\n  * `~3×` faster by adding the `trailing` and `leading` arrays as depthless staging areas (i.e. only modify the tree if these two are full)\r\n* **Optimized `drop` and `take` for `Vector`**\r\n  * `~5×` faster by keeping the leafs intact on drops, as the middle tree already has an `offset` and a `length` that can mask them\r\n* **Optimized `map` for `Vector`** and **Optimized `filter` for `Vector`**\r\n  * `~5×` faster by using the internal `iterator` with `ofAll`\r\n\r\n---\r\n[Benchmarks](https://github.com/paplorinc/javaslang/blob/VectorOptimizations/javaslang-benchmark/src/test/java/javaslang/collection/VectorBenchmark.java):\r\n\r\n```java\r\nOperation  Ratio                                         32     1024    32768\r\nCreate    slang_persistent/java_mutable               0.87×    0.44×    0.58×\r\nCreate    slang_persistent/fjava_persistent         262.15×  193.53×  180.85×\r\nCreate    slang_persistent/pcollections_persistent  123.15×  217.87×  365.56×\r\nCreate    slang_persistent/clojure_persistent         1.13×   12.68×   13.56×\r\nCreate    slang_persistent/scala_persistent          14.73×    8.65×    6.38×\r\n\r\nHead      slang_persistent/java_mutable               0.96×    0.96×    0.96×\r\nHead      slang_persistent/fjava_persistent           1.14×    1.14×    1.13×\r\nHead      slang_persistent/pcollections_persistent    3.04×    6.83×   10.40×\r\nHead      slang_persistent/clojure_persistent         1.04×    1.62×    2.16×\r\nHead      slang_persistent/scala_persistent           1.15×    1.16×    1.15×\r\n\r\nTail      slang_persistent/java_mutable               0.81×    0.72×    0.53×\r\nTail      slang_persistent/fjava_persistent          62.25×   63.52×   63.66×\r\nTail      slang_persistent/pcollections_persistent    7.07×   11.65×   15.90×\r\nTail      slang_persistent/clojure_persistent         1.09×    0.93×    0.74×\r\nTail      slang_persistent/scala_persistent           3.84×    6.64×    8.13×\r\n\r\nGet       slang_persistent/java_mutable               0.86×    0.34×    0.30×\r\nGet       slang_persistent/fjava_persistent          59.15×   82.36×   69.82×\r\nGet       slang_persistent/pcollections_persistent    8.47×   11.56×   15.48×\r\nGet       slang_persistent/clojure_persistent         0.99×    1.07×    1.20×\r\nGet       slang_persistent/scala_persistent           1.26×    0.86×    0.81×\r\n\r\nPrepend   slang_persistent/scala_persistent           1.26×    1.45×    1.51×\r\n\r\nAppend    slang_persistent/scala_persistent           1.00×    0.96×    0.86×\r\n\r\nUpdate    slang_persistent/scala_persistent           1.08×    0.95×    1.08×\r\n\r\nMap       slang_persistent/java_mutable               2.58×    3.20×    2.83×\r\nMap       slang_persistent/scala_persistent           1.19×    2.06×    2.36×\r\n\r\nFilter    slang_persistent/java_mutable               3.51×    2.79×    2.00×\r\nFilter    slang_persistent/scala_persistent           2.34×    2.45×    1.89×\r\n\r\nSlice     slang_persistent/java_mutable               0.26×    0.47×    0.47×\r\nSlice     slang_persistent/clojure_persistent         0.24×    0.43×    0.44×\r\nSlice     slang_persistent/scala_persistent           1.06×    5.36×    8.93×\r\n\r\nIterate   slang_persistent/java_mutable               0.92×    0.34×    0.48×\r\nIterate   slang_persistent/fjava_persistent         399.59×  308.59×  353.47×\r\nIterate   slang_persistent/pcollections_persistent   15.82×   10.44×    9.10×\r\nIterate   slang_persistent/clojure_persistent         0.89×    0.94×    1.23×\r\nIterate   slang_persistent/scala_persistent           1.91×    1.12×    1.10×\r\n```\r\n\r\ni.e.\r\n```java\r\nCreate   6.38 / 0.07 = 91.14× faster\r\nHead     1.15 / 0.49 =  2.34× faster\r\nTail     8.13 / 0.96 =  8.46× faster\r\nGet      0.81 / 0.85 =  0.95× faster\r\nPrepend  1.51 / 0.43 =  3.50× faster\r\nAppend   0.86 / 0.29 =  2.96× faster\r\nUpdate   1.17 / 1.08 =  1.08× faster\r\nMap      2.45 / 0.48 =  5.10× faster\r\nFilter   1.89 / 0.48  = 3.93× faster\r\nSlice    8.93 / 1.64 =  5.44× faster\r\nIterate  1.10 / 0.48 =  2.29× faster\r\n```","created_at":"2016-08-23T14:00:22Z","updated_at":"2016-09-04T21:04:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0087fa2f67fdfedbe0a445c86bdc08753437a233","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":4,"closed_issues":241,"state":"open","created_at":"2015-09-07T18:46:28Z","updated_at":"2016-09-04T16:01:34Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/javaslang/javaslang/pulls/1522/commits","review_comments_url":"https://api.github.com/repos/javaslang/javaslang/pulls/1522/comments","review_comment_url":"https://api.github.com/repos/javaslang/javaslang/pulls/comments{/number}","comments_url":"https://api.github.com/repos/javaslang/javaslang/issues/1522/comments","statuses_url":"https://api.github.com/repos/javaslang/javaslang/statuses/a8a847cc39db66f2c17482f74c3719a8a016d412","head":{"label":"paplorinc:VectorOptimizations","ref":"VectorOptimizations","sha":"a8a847cc39db66f2c17482f74c3719a8a016d412","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-09-04T20:16:29Z","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":12676,"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":"9311fee6f428e7736a15ec8595831e619d541f98","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-09-03T14:26:59Z","pushed_at":"2016-09-04T18:00:23Z","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":14300,"stargazers_count":1122,"watchers_count":1122,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":132,"mirror_url":null,"open_issues_count":123,"forks":132,"open_issues":123,"watchers":1122,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/1522"},"html":{"href":"https://github.com/javaslang/javaslang/pull/1522"},"issue":{"href":"https://api.github.com/repos/javaslang/javaslang/issues/1522"},"comments":{"href":"https://api.github.com/repos/javaslang/javaslang/issues/1522/comments"},"review_comments":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/1522/comments"},"review_comment":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/1522/commits"},"statuses":{"href":"https://api.github.com/repos/javaslang/javaslang/statuses/a8a847cc39db66f2c17482f74c3719a8a016d412"}}}}
{"actor":{"display_login":"danieldietrich"}}