{"action":"created","comment":{"url":"https://api.github.com/repos/thoughtbot/Argo/pulls/comments/49286566","id":49286566,"diff_hunk":"@@ -1,11 +1,26 @@\n public func catDecoded<T>(xs: [Decoded<T>]) -> [T] {\n-  return xs.reduce([]) { accum, elem in\n-    elem.map { accum + [$0] } ?? accum\n+  var accum: [T] = []\n+  accum.reserveCapacity(xs.count)\n+  ","path":"Argo/Functions/catDecoded.swift","position":6,"original_position":6,"commit_id":"fdcf30310330eb2cb731722fe59368407ca193b0","original_commit_id":"fdcf30310330eb2cb731722fe59368407ca193b0","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)","created_at":"2016-01-11T02:25:54Z","updated_at":"2016-01-11T02:25:54Z","html_url":"https://github.com/thoughtbot/Argo/pull/317#discussion_r49286566","pull_request_url":"https://api.github.com/repos/thoughtbot/Argo/pulls/317","_links":{"self":{"href":"https://api.github.com/repos/thoughtbot/Argo/pulls/comments/49286566"},"html":{"href":"https://github.com/thoughtbot/Argo/pull/317#discussion_r49286566"},"pull_request":{"href":"https://api.github.com/repos/thoughtbot/Argo/pulls/317"}}},"pull_request":{"url":"https://api.github.com/repos/thoughtbot/Argo/pulls/317","id":55582192,"html_url":"https://github.com/thoughtbot/Argo/pull/317","diff_url":"https://github.com/thoughtbot/Argo/pull/317.diff","patch_url":"https://github.com/thoughtbot/Argo/pull/317.patch","issue_url":"https://api.github.com/repos/thoughtbot/Argo/issues/317","number":317,"state":"open","locked":false,"title":"Remove reduce usage for better performance","user":{"login":"jshier","id":51020,"avatar_url":"https://avatars.githubusercontent.com/u/51020?v=3","gravatar_id":"","url":"https://api.github.com/users/jshier","html_url":"https://github.com/jshier","followers_url":"https://api.github.com/users/jshier/followers","following_url":"https://api.github.com/users/jshier/following{/other_user}","gists_url":"https://api.github.com/users/jshier/gists{/gist_id}","starred_url":"https://api.github.com/users/jshier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jshier/subscriptions","organizations_url":"https://api.github.com/users/jshier/orgs","repos_url":"https://api.github.com/users/jshier/repos","events_url":"https://api.github.com/users/jshier/events{/privacy}","received_events_url":"https://api.github.com/users/jshier/received_events","type":"User","site_admin":false},"body":"Argo’s performance is quadratic over the size of the collection being decoded, due to the use of reduce ([AirspeedVelocity article](http://airspeedvelocity.net/2015/08/03/arrays-linked-lists-and-performance/)).\r\nThis PR removes most usages of `reduce` in exchange for a `for` loop of the same functionality. This improves the performance of decoding an array of over 9000 simple models on an iPhone 4S by ~2600% (76.4s to 2.9s). See #295 for my analysis and evolution of this code.","created_at":"2016-01-11T02:25:42Z","updated_at":"2016-01-11T02:25:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"54764709bf6209bbe66c6d36d5df88d5d7002627","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/thoughtbot/Argo/pulls/317/commits","review_comments_url":"https://api.github.com/repos/thoughtbot/Argo/pulls/317/comments","review_comment_url":"https://api.github.com/repos/thoughtbot/Argo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/thoughtbot/Argo/issues/317/comments","statuses_url":"https://api.github.com/repos/thoughtbot/Argo/statuses/fdcf30310330eb2cb731722fe59368407ca193b0","head":{"label":"jshier:reduce-removal","ref":"reduce-removal","sha":"fdcf30310330eb2cb731722fe59368407ca193b0","user":{"login":"jshier","id":51020,"avatar_url":"https://avatars.githubusercontent.com/u/51020?v=3","gravatar_id":"","url":"https://api.github.com/users/jshier","html_url":"https://github.com/jshier","followers_url":"https://api.github.com/users/jshier/followers","following_url":"https://api.github.com/users/jshier/following{/other_user}","gists_url":"https://api.github.com/users/jshier/gists{/gist_id}","starred_url":"https://api.github.com/users/jshier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jshier/subscriptions","organizations_url":"https://api.github.com/users/jshier/orgs","repos_url":"https://api.github.com/users/jshier/repos","events_url":"https://api.github.com/users/jshier/events{/privacy}","received_events_url":"https://api.github.com/users/jshier/received_events","type":"User","site_admin":false},"repo":{"id":48351192,"name":"Argo","full_name":"jshier/Argo","owner":{"login":"jshier","id":51020,"avatar_url":"https://avatars.githubusercontent.com/u/51020?v=3","gravatar_id":"","url":"https://api.github.com/users/jshier","html_url":"https://github.com/jshier","followers_url":"https://api.github.com/users/jshier/followers","following_url":"https://api.github.com/users/jshier/following{/other_user}","gists_url":"https://api.github.com/users/jshier/gists{/gist_id}","starred_url":"https://api.github.com/users/jshier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jshier/subscriptions","organizations_url":"https://api.github.com/users/jshier/orgs","repos_url":"https://api.github.com/users/jshier/repos","events_url":"https://api.github.com/users/jshier/events{/privacy}","received_events_url":"https://api.github.com/users/jshier/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jshier/Argo","description":"Functional JSON parsing library for Swift","fork":true,"url":"https://api.github.com/repos/jshier/Argo","forks_url":"https://api.github.com/repos/jshier/Argo/forks","keys_url":"https://api.github.com/repos/jshier/Argo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jshier/Argo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jshier/Argo/teams","hooks_url":"https://api.github.com/repos/jshier/Argo/hooks","issue_events_url":"https://api.github.com/repos/jshier/Argo/issues/events{/number}","events_url":"https://api.github.com/repos/jshier/Argo/events","assignees_url":"https://api.github.com/repos/jshier/Argo/assignees{/user}","branches_url":"https://api.github.com/repos/jshier/Argo/branches{/branch}","tags_url":"https://api.github.com/repos/jshier/Argo/tags","blobs_url":"https://api.github.com/repos/jshier/Argo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jshier/Argo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jshier/Argo/git/refs{/sha}","trees_url":"https://api.github.com/repos/jshier/Argo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jshier/Argo/statuses/{sha}","languages_url":"https://api.github.com/repos/jshier/Argo/languages","stargazers_url":"https://api.github.com/repos/jshier/Argo/stargazers","contributors_url":"https://api.github.com/repos/jshier/Argo/contributors","subscribers_url":"https://api.github.com/repos/jshier/Argo/subscribers","subscription_url":"https://api.github.com/repos/jshier/Argo/subscription","commits_url":"https://api.github.com/repos/jshier/Argo/commits{/sha}","git_commits_url":"https://api.github.com/repos/jshier/Argo/git/commits{/sha}","comments_url":"https://api.github.com/repos/jshier/Argo/comments{/number}","issue_comment_url":"https://api.github.com/repos/jshier/Argo/issues/comments{/number}","contents_url":"https://api.github.com/repos/jshier/Argo/contents/{+path}","compare_url":"https://api.github.com/repos/jshier/Argo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jshier/Argo/merges","archive_url":"https://api.github.com/repos/jshier/Argo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jshier/Argo/downloads","issues_url":"https://api.github.com/repos/jshier/Argo/issues{/number}","pulls_url":"https://api.github.com/repos/jshier/Argo/pulls{/number}","milestones_url":"https://api.github.com/repos/jshier/Argo/milestones{/number}","notifications_url":"https://api.github.com/repos/jshier/Argo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jshier/Argo/labels{/name}","releases_url":"https://api.github.com/repos/jshier/Argo/releases{/id}","created_at":"2015-12-21T04:46:55Z","updated_at":"2015-12-21T04:46:56Z","pushed_at":"2016-01-11T02:19:29Z","git_url":"git://github.com/jshier/Argo.git","ssh_url":"git@github.com:jshier/Argo.git","clone_url":"https://github.com/jshier/Argo.git","svn_url":"https://github.com/jshier/Argo","homepage":"https://thoughtbot.com/open-source","size":979,"stargazers_count":0,"watchers_count":0,"language":"Swift","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":"thoughtbot:master","ref":"master","sha":"dce33c119722a9f84884029a5bedfd9e29ce944e","user":{"login":"thoughtbot","id":6183,"avatar_url":"https://avatars.githubusercontent.com/u/6183?v=3","gravatar_id":"","url":"https://api.github.com/users/thoughtbot","html_url":"https://github.com/thoughtbot","followers_url":"https://api.github.com/users/thoughtbot/followers","following_url":"https://api.github.com/users/thoughtbot/following{/other_user}","gists_url":"https://api.github.com/users/thoughtbot/gists{/gist_id}","starred_url":"https://api.github.com/users/thoughtbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoughtbot/subscriptions","organizations_url":"https://api.github.com/users/thoughtbot/orgs","repos_url":"https://api.github.com/users/thoughtbot/repos","events_url":"https://api.github.com/users/thoughtbot/events{/privacy}","received_events_url":"https://api.github.com/users/thoughtbot/received_events","type":"Organization","site_admin":false},"repo":{"id":24349480,"name":"Argo","full_name":"thoughtbot/Argo","owner":{"login":"thoughtbot","id":6183,"avatar_url":"https://avatars.githubusercontent.com/u/6183?v=3","gravatar_id":"","url":"https://api.github.com/users/thoughtbot","html_url":"https://github.com/thoughtbot","followers_url":"https://api.github.com/users/thoughtbot/followers","following_url":"https://api.github.com/users/thoughtbot/following{/other_user}","gists_url":"https://api.github.com/users/thoughtbot/gists{/gist_id}","starred_url":"https://api.github.com/users/thoughtbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoughtbot/subscriptions","organizations_url":"https://api.github.com/users/thoughtbot/orgs","repos_url":"https://api.github.com/users/thoughtbot/repos","events_url":"https://api.github.com/users/thoughtbot/events{/privacy}","received_events_url":"https://api.github.com/users/thoughtbot/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/thoughtbot/Argo","description":"Functional JSON parsing library for Swift","fork":false,"url":"https://api.github.com/repos/thoughtbot/Argo","forks_url":"https://api.github.com/repos/thoughtbot/Argo/forks","keys_url":"https://api.github.com/repos/thoughtbot/Argo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thoughtbot/Argo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thoughtbot/Argo/teams","hooks_url":"https://api.github.com/repos/thoughtbot/Argo/hooks","issue_events_url":"https://api.github.com/repos/thoughtbot/Argo/issues/events{/number}","events_url":"https://api.github.com/repos/thoughtbot/Argo/events","assignees_url":"https://api.github.com/repos/thoughtbot/Argo/assignees{/user}","branches_url":"https://api.github.com/repos/thoughtbot/Argo/branches{/branch}","tags_url":"https://api.github.com/repos/thoughtbot/Argo/tags","blobs_url":"https://api.github.com/repos/thoughtbot/Argo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thoughtbot/Argo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thoughtbot/Argo/git/refs{/sha}","trees_url":"https://api.github.com/repos/thoughtbot/Argo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thoughtbot/Argo/statuses/{sha}","languages_url":"https://api.github.com/repos/thoughtbot/Argo/languages","stargazers_url":"https://api.github.com/repos/thoughtbot/Argo/stargazers","contributors_url":"https://api.github.com/repos/thoughtbot/Argo/contributors","subscribers_url":"https://api.github.com/repos/thoughtbot/Argo/subscribers","subscription_url":"https://api.github.com/repos/thoughtbot/Argo/subscription","commits_url":"https://api.github.com/repos/thoughtbot/Argo/commits{/sha}","git_commits_url":"https://api.github.com/repos/thoughtbot/Argo/git/commits{/sha}","comments_url":"https://api.github.com/repos/thoughtbot/Argo/comments{/number}","issue_comment_url":"https://api.github.com/repos/thoughtbot/Argo/issues/comments{/number}","contents_url":"https://api.github.com/repos/thoughtbot/Argo/contents/{+path}","compare_url":"https://api.github.com/repos/thoughtbot/Argo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thoughtbot/Argo/merges","archive_url":"https://api.github.com/repos/thoughtbot/Argo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thoughtbot/Argo/downloads","issues_url":"https://api.github.com/repos/thoughtbot/Argo/issues{/number}","pulls_url":"https://api.github.com/repos/thoughtbot/Argo/pulls{/number}","milestones_url":"https://api.github.com/repos/thoughtbot/Argo/milestones{/number}","notifications_url":"https://api.github.com/repos/thoughtbot/Argo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thoughtbot/Argo/labels{/name}","releases_url":"https://api.github.com/repos/thoughtbot/Argo/releases{/id}","created_at":"2014-09-22T23:37:03Z","updated_at":"2016-01-10T17:29:31Z","pushed_at":"2016-01-11T02:25:43Z","git_url":"git://github.com/thoughtbot/Argo.git","ssh_url":"git@github.com:thoughtbot/Argo.git","clone_url":"https://github.com/thoughtbot/Argo.git","svn_url":"https://github.com/thoughtbot/Argo","homepage":"https://thoughtbot.com/open-source","size":1471,"stargazers_count":1876,"watchers_count":1876,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":119,"mirror_url":null,"open_issues_count":25,"forks":119,"open_issues":25,"watchers":1876,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/thoughtbot/Argo/pulls/317"},"html":{"href":"https://github.com/thoughtbot/Argo/pull/317"},"issue":{"href":"https://api.github.com/repos/thoughtbot/Argo/issues/317"},"comments":{"href":"https://api.github.com/repos/thoughtbot/Argo/issues/317/comments"},"review_comments":{"href":"https://api.github.com/repos/thoughtbot/Argo/pulls/317/comments"},"review_comment":{"href":"https://api.github.com/repos/thoughtbot/Argo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/thoughtbot/Argo/pulls/317/commits"},"statuses":{"href":"https://api.github.com/repos/thoughtbot/Argo/statuses/fdcf30310330eb2cb731722fe59368407ca193b0"}}}}