{"action":"created","comment":{"url":"https://api.github.com/repos/apple/swift/pulls/comments/47812344","id":47812344,"diff_hunk":"@@ -74,27 +74,15 @@ public func min<T : Comparable>(x: T, _ y: T, _ z: T, _ rest: T...) -> T {\n /// Returns the greater of `x` and `y`.\n @warn_unused_result\n public func max<T : Comparable>(x: T, _ y: T) -> T {\n-  var r = y\n-  if y < x {\n-    r = x\n-  }\n-  return r\n+  return y >= x ? y : x\n }\n \n /// Returns the greatest argument passed.\n @warn_unused_result\n public func max<T : Comparable>(x: T, _ y: T, _ z: T, _ rest: T...) -> T {\n-  var r = y\n-  if y < x {\n-    r = x\n-  }\n-  if r < z {\n-    r = z\n-  }\n-  for t in rest {\n-    if t >= r {\n-      r = t\n-    }\n+  var r = x\n+  for t in [y, z] + rest where t >= r {","path":"stdlib/public/core/Algorithm.swift","position":27,"original_position":27,"commit_id":"179600afd0ae7db1be2b2aedf60ef2d13cb48f6b","original_commit_id":"179600afd0ae7db1be2b2aedf60ef2d13cb48f6b","user":{"login":"gribozavr","id":1120569,"avatar_url":"https://avatars.githubusercontent.com/u/1120569?v=3","gravatar_id":"","url":"https://api.github.com/users/gribozavr","html_url":"https://github.com/gribozavr","followers_url":"https://api.github.com/users/gribozavr/followers","following_url":"https://api.github.com/users/gribozavr/following{/other_user}","gists_url":"https://api.github.com/users/gribozavr/gists{/gist_id}","starred_url":"https://api.github.com/users/gribozavr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gribozavr/subscriptions","organizations_url":"https://api.github.com/users/gribozavr/orgs","repos_url":"https://api.github.com/users/gribozavr/repos","events_url":"https://api.github.com/users/gribozavr/events{/privacy}","received_events_url":"https://api.github.com/users/gribozavr/received_events","type":"User","site_admin":false},"body":"You are still creating an array here, this will be slow.","created_at":"2015-12-16T18:16:43Z","updated_at":"2015-12-16T18:16:43Z","html_url":"https://github.com/apple/swift/pull/566#discussion_r47812344","pull_request_url":"https://api.github.com/repos/apple/swift/pulls/566","_links":{"self":{"href":"https://api.github.com/repos/apple/swift/pulls/comments/47812344"},"html":{"href":"https://github.com/apple/swift/pull/566#discussion_r47812344"},"pull_request":{"href":"https://api.github.com/repos/apple/swift/pulls/566"}}},"pull_request":{"url":"https://api.github.com/repos/apple/swift/pulls/566","id":53756650,"html_url":"https://github.com/apple/swift/pull/566","diff_url":"https://github.com/apple/swift/pull/566.diff","patch_url":"https://github.com/apple/swift/pull/566.patch","issue_url":"https://api.github.com/repos/apple/swift/issues/566","number":566,"state":"open","locked":false,"title":"[tests] basic min/max test cases","user":{"login":"frootloops","id":861670,"avatar_url":"https://avatars.githubusercontent.com/u/861670?v=3","gravatar_id":"","url":"https://api.github.com/users/frootloops","html_url":"https://github.com/frootloops","followers_url":"https://api.github.com/users/frootloops/followers","following_url":"https://api.github.com/users/frootloops/following{/other_user}","gists_url":"https://api.github.com/users/frootloops/gists{/gist_id}","starred_url":"https://api.github.com/users/frootloops/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frootloops/subscriptions","organizations_url":"https://api.github.com/users/frootloops/orgs","repos_url":"https://api.github.com/users/frootloops/repos","events_url":"https://api.github.com/users/frootloops/events{/privacy}","received_events_url":"https://api.github.com/users/frootloops/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-15T20:20:57Z","updated_at":"2015-12-16T18:16:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ca4a17abc3b08d47b33d82ee5ba25696d01a6f09","assignee":{"login":"gribozavr","id":1120569,"avatar_url":"https://avatars.githubusercontent.com/u/1120569?v=3","gravatar_id":"","url":"https://api.github.com/users/gribozavr","html_url":"https://github.com/gribozavr","followers_url":"https://api.github.com/users/gribozavr/followers","following_url":"https://api.github.com/users/gribozavr/following{/other_user}","gists_url":"https://api.github.com/users/gribozavr/gists{/gist_id}","starred_url":"https://api.github.com/users/gribozavr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gribozavr/subscriptions","organizations_url":"https://api.github.com/users/gribozavr/orgs","repos_url":"https://api.github.com/users/gribozavr/repos","events_url":"https://api.github.com/users/gribozavr/events{/privacy}","received_events_url":"https://api.github.com/users/gribozavr/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/apple/swift/pulls/566/commits","review_comments_url":"https://api.github.com/repos/apple/swift/pulls/566/comments","review_comment_url":"https://api.github.com/repos/apple/swift/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apple/swift/issues/566/comments","statuses_url":"https://api.github.com/repos/apple/swift/statuses/179600afd0ae7db1be2b2aedf60ef2d13cb48f6b","head":{"label":"frootloops:test-algorithm","ref":"test-algorithm","sha":"179600afd0ae7db1be2b2aedf60ef2d13cb48f6b","user":{"login":"frootloops","id":861670,"avatar_url":"https://avatars.githubusercontent.com/u/861670?v=3","gravatar_id":"","url":"https://api.github.com/users/frootloops","html_url":"https://github.com/frootloops","followers_url":"https://api.github.com/users/frootloops/followers","following_url":"https://api.github.com/users/frootloops/following{/other_user}","gists_url":"https://api.github.com/users/frootloops/gists{/gist_id}","starred_url":"https://api.github.com/users/frootloops/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frootloops/subscriptions","organizations_url":"https://api.github.com/users/frootloops/orgs","repos_url":"https://api.github.com/users/frootloops/repos","events_url":"https://api.github.com/users/frootloops/events{/privacy}","received_events_url":"https://api.github.com/users/frootloops/received_events","type":"User","site_admin":false},"repo":{"id":47353126,"name":"swift","full_name":"frootloops/swift","owner":{"login":"frootloops","id":861670,"avatar_url":"https://avatars.githubusercontent.com/u/861670?v=3","gravatar_id":"","url":"https://api.github.com/users/frootloops","html_url":"https://github.com/frootloops","followers_url":"https://api.github.com/users/frootloops/followers","following_url":"https://api.github.com/users/frootloops/following{/other_user}","gists_url":"https://api.github.com/users/frootloops/gists{/gist_id}","starred_url":"https://api.github.com/users/frootloops/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frootloops/subscriptions","organizations_url":"https://api.github.com/users/frootloops/orgs","repos_url":"https://api.github.com/users/frootloops/repos","events_url":"https://api.github.com/users/frootloops/events{/privacy}","received_events_url":"https://api.github.com/users/frootloops/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/frootloops/swift","description":"The Swift Programming Language","fork":true,"url":"https://api.github.com/repos/frootloops/swift","forks_url":"https://api.github.com/repos/frootloops/swift/forks","keys_url":"https://api.github.com/repos/frootloops/swift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/frootloops/swift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/frootloops/swift/teams","hooks_url":"https://api.github.com/repos/frootloops/swift/hooks","issue_events_url":"https://api.github.com/repos/frootloops/swift/issues/events{/number}","events_url":"https://api.github.com/repos/frootloops/swift/events","assignees_url":"https://api.github.com/repos/frootloops/swift/assignees{/user}","branches_url":"https://api.github.com/repos/frootloops/swift/branches{/branch}","tags_url":"https://api.github.com/repos/frootloops/swift/tags","blobs_url":"https://api.github.com/repos/frootloops/swift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/frootloops/swift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/frootloops/swift/git/refs{/sha}","trees_url":"https://api.github.com/repos/frootloops/swift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/frootloops/swift/statuses/{sha}","languages_url":"https://api.github.com/repos/frootloops/swift/languages","stargazers_url":"https://api.github.com/repos/frootloops/swift/stargazers","contributors_url":"https://api.github.com/repos/frootloops/swift/contributors","subscribers_url":"https://api.github.com/repos/frootloops/swift/subscribers","subscription_url":"https://api.github.com/repos/frootloops/swift/subscription","commits_url":"https://api.github.com/repos/frootloops/swift/commits{/sha}","git_commits_url":"https://api.github.com/repos/frootloops/swift/git/commits{/sha}","comments_url":"https://api.github.com/repos/frootloops/swift/comments{/number}","issue_comment_url":"https://api.github.com/repos/frootloops/swift/issues/comments{/number}","contents_url":"https://api.github.com/repos/frootloops/swift/contents/{+path}","compare_url":"https://api.github.com/repos/frootloops/swift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/frootloops/swift/merges","archive_url":"https://api.github.com/repos/frootloops/swift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/frootloops/swift/downloads","issues_url":"https://api.github.com/repos/frootloops/swift/issues{/number}","pulls_url":"https://api.github.com/repos/frootloops/swift/pulls{/number}","milestones_url":"https://api.github.com/repos/frootloops/swift/milestones{/number}","notifications_url":"https://api.github.com/repos/frootloops/swift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/frootloops/swift/labels{/name}","releases_url":"https://api.github.com/repos/frootloops/swift/releases{/id}","created_at":"2015-12-03T18:54:13Z","updated_at":"2015-12-03T18:54:43Z","pushed_at":"2015-12-16T18:03:07Z","git_url":"git://github.com/frootloops/swift.git","ssh_url":"git@github.com:frootloops/swift.git","clone_url":"https://github.com/frootloops/swift.git","svn_url":"https://github.com/frootloops/swift","homepage":"","size":61071,"stargazers_count":0,"watchers_count":0,"language":"C++","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":"apple:master","ref":"master","sha":"0136804892f783140166c4424f908589b2654d82","user":{"login":"apple","id":10639145,"avatar_url":"https://avatars.githubusercontent.com/u/10639145?v=3","gravatar_id":"","url":"https://api.github.com/users/apple","html_url":"https://github.com/apple","followers_url":"https://api.github.com/users/apple/followers","following_url":"https://api.github.com/users/apple/following{/other_user}","gists_url":"https://api.github.com/users/apple/gists{/gist_id}","starred_url":"https://api.github.com/users/apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apple/subscriptions","organizations_url":"https://api.github.com/users/apple/orgs","repos_url":"https://api.github.com/users/apple/repos","events_url":"https://api.github.com/users/apple/events{/privacy}","received_events_url":"https://api.github.com/users/apple/received_events","type":"Organization","site_admin":false},"repo":{"id":44838949,"name":"swift","full_name":"apple/swift","owner":{"login":"apple","id":10639145,"avatar_url":"https://avatars.githubusercontent.com/u/10639145?v=3","gravatar_id":"","url":"https://api.github.com/users/apple","html_url":"https://github.com/apple","followers_url":"https://api.github.com/users/apple/followers","following_url":"https://api.github.com/users/apple/following{/other_user}","gists_url":"https://api.github.com/users/apple/gists{/gist_id}","starred_url":"https://api.github.com/users/apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apple/subscriptions","organizations_url":"https://api.github.com/users/apple/orgs","repos_url":"https://api.github.com/users/apple/repos","events_url":"https://api.github.com/users/apple/events{/privacy}","received_events_url":"https://api.github.com/users/apple/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apple/swift","description":"The Swift Programming Language","fork":false,"url":"https://api.github.com/repos/apple/swift","forks_url":"https://api.github.com/repos/apple/swift/forks","keys_url":"https://api.github.com/repos/apple/swift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apple/swift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apple/swift/teams","hooks_url":"https://api.github.com/repos/apple/swift/hooks","issue_events_url":"https://api.github.com/repos/apple/swift/issues/events{/number}","events_url":"https://api.github.com/repos/apple/swift/events","assignees_url":"https://api.github.com/repos/apple/swift/assignees{/user}","branches_url":"https://api.github.com/repos/apple/swift/branches{/branch}","tags_url":"https://api.github.com/repos/apple/swift/tags","blobs_url":"https://api.github.com/repos/apple/swift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apple/swift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apple/swift/git/refs{/sha}","trees_url":"https://api.github.com/repos/apple/swift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apple/swift/statuses/{sha}","languages_url":"https://api.github.com/repos/apple/swift/languages","stargazers_url":"https://api.github.com/repos/apple/swift/stargazers","contributors_url":"https://api.github.com/repos/apple/swift/contributors","subscribers_url":"https://api.github.com/repos/apple/swift/subscribers","subscription_url":"https://api.github.com/repos/apple/swift/subscription","commits_url":"https://api.github.com/repos/apple/swift/commits{/sha}","git_commits_url":"https://api.github.com/repos/apple/swift/git/commits{/sha}","comments_url":"https://api.github.com/repos/apple/swift/comments{/number}","issue_comment_url":"https://api.github.com/repos/apple/swift/issues/comments{/number}","contents_url":"https://api.github.com/repos/apple/swift/contents/{+path}","compare_url":"https://api.github.com/repos/apple/swift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apple/swift/merges","archive_url":"https://api.github.com/repos/apple/swift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apple/swift/downloads","issues_url":"https://api.github.com/repos/apple/swift/issues{/number}","pulls_url":"https://api.github.com/repos/apple/swift/pulls{/number}","milestones_url":"https://api.github.com/repos/apple/swift/milestones{/number}","notifications_url":"https://api.github.com/repos/apple/swift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apple/swift/labels{/name}","releases_url":"https://api.github.com/repos/apple/swift/releases{/id}","created_at":"2015-10-23T21:15:07Z","updated_at":"2015-12-16T17:45:43Z","pushed_at":"2015-12-16T18:02:03Z","git_url":"git://github.com/apple/swift.git","ssh_url":"git@github.com:apple/swift.git","clone_url":"https://github.com/apple/swift.git","svn_url":"https://github.com/apple/swift","homepage":"https://swift.org/","size":77890,"stargazers_count":23700,"watchers_count":23700,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2836,"mirror_url":null,"open_issues_count":57,"forks":2836,"open_issues":57,"watchers":23700,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apple/swift/pulls/566"},"html":{"href":"https://github.com/apple/swift/pull/566"},"issue":{"href":"https://api.github.com/repos/apple/swift/issues/566"},"comments":{"href":"https://api.github.com/repos/apple/swift/issues/566/comments"},"review_comments":{"href":"https://api.github.com/repos/apple/swift/pulls/566/comments"},"review_comment":{"href":"https://api.github.com/repos/apple/swift/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apple/swift/pulls/566/commits"},"statuses":{"href":"https://api.github.com/repos/apple/swift/statuses/179600afd0ae7db1be2b2aedf60ef2d13cb48f6b"}}}}