{"action":"created","comment":{"url":"https://api.github.com/repos/composer/composer/pulls/comments/83412693","pull_request_review_id":4259053,"id":83412693,"diff_hunk":"@@ -682,8 +682,9 @@ private function runSat($disableRules = true)\n         $level = 1;\n         $systemLevel = $level + 1;\n         $installedPos = 0;\n+        $rulesCount = count($this->rules);\n \n-        while (true) {\n+        for (;;) {","path":"src/Composer/DependencyResolver/Solver.php","position":null,"original_position":7,"commit_id":"e5e5323d103a8d1c8d088f2fc0751d80354e9007","original_commit_id":"d9066e69a341e9331eb013e4abf84e02aaaedeab","user":{"login":"stof","id":439401,"avatar_url":"https://avatars.githubusercontent.com/u/439401?v=3","gravatar_id":"","url":"https://api.github.com/users/stof","html_url":"https://github.com/stof","followers_url":"https://api.github.com/users/stof/followers","following_url":"https://api.github.com/users/stof/following{/other_user}","gists_url":"https://api.github.com/users/stof/gists{/gist_id}","starred_url":"https://api.github.com/users/stof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stof/subscriptions","organizations_url":"https://api.github.com/users/stof/orgs","repos_url":"https://api.github.com/users/stof/repos","events_url":"https://api.github.com/users/stof/events{/privacy}","received_events_url":"https://api.github.com/users/stof/received_events","type":"User","site_admin":false},"body":"looks like PHP already understands the optimization I was talking about :smile: ","created_at":"2016-10-14T12:34:01Z","updated_at":"2016-10-14T12:34:01Z","html_url":"https://github.com/composer/composer/pull/5785#discussion_r83412693","pull_request_url":"https://api.github.com/repos/composer/composer/pulls/5785","_links":{"self":{"href":"https://api.github.com/repos/composer/composer/pulls/comments/83412693"},"html":{"href":"https://github.com/composer/composer/pull/5785#discussion_r83412693"},"pull_request":{"href":"https://api.github.com/repos/composer/composer/pulls/5785"}}},"pull_request":{"url":"https://api.github.com/repos/composer/composer/pulls/5785","id":89370533,"html_url":"https://github.com/composer/composer/pull/5785","diff_url":"https://github.com/composer/composer/pull/5785.diff","patch_url":"https://github.com/composer/composer/pull/5785.patch","issue_url":"https://api.github.com/repos/composer/composer/issues/5785","number":5785,"state":"open","locked":false,"title":"Enhance performance by removing count() from Solver's main loop","user":{"login":"nicolas-grekas","id":243674,"avatar_url":"https://avatars.githubusercontent.com/u/243674?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolas-grekas","html_url":"https://github.com/nicolas-grekas","followers_url":"https://api.github.com/users/nicolas-grekas/followers","following_url":"https://api.github.com/users/nicolas-grekas/following{/other_user}","gists_url":"https://api.github.com/users/nicolas-grekas/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolas-grekas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolas-grekas/subscriptions","organizations_url":"https://api.github.com/users/nicolas-grekas/orgs","repos_url":"https://api.github.com/users/nicolas-grekas/repos","events_url":"https://api.github.com/users/nicolas-grekas/events{/privacy}","received_events_url":"https://api.github.com/users/nicolas-grekas/received_events","type":"User","site_admin":false},"body":"Thanks to [blackfire.io](https://blackfire.io), I spotted that `count()` is hurting performance for no reason here. It was called 730023965 times in the case I was working on, not unusual.\r\n\r\nUsing `time` to \"profile\" the patch, `composer up` dropped from 290s to 140s (PHP7.1)!","created_at":"2016-10-14T11:45:26Z","updated_at":"2016-10-14T12:34:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d239434dd003426385cfd7585b6191341ff706a0","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/composer/composer/pulls/5785/commits","review_comments_url":"https://api.github.com/repos/composer/composer/pulls/5785/comments","review_comment_url":"https://api.github.com/repos/composer/composer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/composer/composer/issues/5785/comments","statuses_url":"https://api.github.com/repos/composer/composer/statuses/e5e5323d103a8d1c8d088f2fc0751d80354e9007","head":{"label":"nicolas-grekas:perf","ref":"perf","sha":"e5e5323d103a8d1c8d088f2fc0751d80354e9007","user":{"login":"nicolas-grekas","id":243674,"avatar_url":"https://avatars.githubusercontent.com/u/243674?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolas-grekas","html_url":"https://github.com/nicolas-grekas","followers_url":"https://api.github.com/users/nicolas-grekas/followers","following_url":"https://api.github.com/users/nicolas-grekas/following{/other_user}","gists_url":"https://api.github.com/users/nicolas-grekas/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolas-grekas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolas-grekas/subscriptions","organizations_url":"https://api.github.com/users/nicolas-grekas/orgs","repos_url":"https://api.github.com/users/nicolas-grekas/repos","events_url":"https://api.github.com/users/nicolas-grekas/events{/privacy}","received_events_url":"https://api.github.com/users/nicolas-grekas/received_events","type":"User","site_admin":false},"repo":{"id":16522834,"name":"composer","full_name":"nicolas-grekas/composer","owner":{"login":"nicolas-grekas","id":243674,"avatar_url":"https://avatars.githubusercontent.com/u/243674?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolas-grekas","html_url":"https://github.com/nicolas-grekas","followers_url":"https://api.github.com/users/nicolas-grekas/followers","following_url":"https://api.github.com/users/nicolas-grekas/following{/other_user}","gists_url":"https://api.github.com/users/nicolas-grekas/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolas-grekas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolas-grekas/subscriptions","organizations_url":"https://api.github.com/users/nicolas-grekas/orgs","repos_url":"https://api.github.com/users/nicolas-grekas/repos","events_url":"https://api.github.com/users/nicolas-grekas/events{/privacy}","received_events_url":"https://api.github.com/users/nicolas-grekas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nicolas-grekas/composer","description":"Dependency Manager for PHP","fork":true,"url":"https://api.github.com/repos/nicolas-grekas/composer","forks_url":"https://api.github.com/repos/nicolas-grekas/composer/forks","keys_url":"https://api.github.com/repos/nicolas-grekas/composer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nicolas-grekas/composer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nicolas-grekas/composer/teams","hooks_url":"https://api.github.com/repos/nicolas-grekas/composer/hooks","issue_events_url":"https://api.github.com/repos/nicolas-grekas/composer/issues/events{/number}","events_url":"https://api.github.com/repos/nicolas-grekas/composer/events","assignees_url":"https://api.github.com/repos/nicolas-grekas/composer/assignees{/user}","branches_url":"https://api.github.com/repos/nicolas-grekas/composer/branches{/branch}","tags_url":"https://api.github.com/repos/nicolas-grekas/composer/tags","blobs_url":"https://api.github.com/repos/nicolas-grekas/composer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nicolas-grekas/composer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nicolas-grekas/composer/git/refs{/sha}","trees_url":"https://api.github.com/repos/nicolas-grekas/composer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nicolas-grekas/composer/statuses/{sha}","languages_url":"https://api.github.com/repos/nicolas-grekas/composer/languages","stargazers_url":"https://api.github.com/repos/nicolas-grekas/composer/stargazers","contributors_url":"https://api.github.com/repos/nicolas-grekas/composer/contributors","subscribers_url":"https://api.github.com/repos/nicolas-grekas/composer/subscribers","subscription_url":"https://api.github.com/repos/nicolas-grekas/composer/subscription","commits_url":"https://api.github.com/repos/nicolas-grekas/composer/commits{/sha}","git_commits_url":"https://api.github.com/repos/nicolas-grekas/composer/git/commits{/sha}","comments_url":"https://api.github.com/repos/nicolas-grekas/composer/comments{/number}","issue_comment_url":"https://api.github.com/repos/nicolas-grekas/composer/issues/comments{/number}","contents_url":"https://api.github.com/repos/nicolas-grekas/composer/contents/{+path}","compare_url":"https://api.github.com/repos/nicolas-grekas/composer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nicolas-grekas/composer/merges","archive_url":"https://api.github.com/repos/nicolas-grekas/composer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nicolas-grekas/composer/downloads","issues_url":"https://api.github.com/repos/nicolas-grekas/composer/issues{/number}","pulls_url":"https://api.github.com/repos/nicolas-grekas/composer/pulls{/number}","milestones_url":"https://api.github.com/repos/nicolas-grekas/composer/milestones{/number}","notifications_url":"https://api.github.com/repos/nicolas-grekas/composer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nicolas-grekas/composer/labels{/name}","releases_url":"https://api.github.com/repos/nicolas-grekas/composer/releases{/id}","deployments_url":"https://api.github.com/repos/nicolas-grekas/composer/deployments","created_at":"2014-02-04T19:26:50Z","updated_at":"2015-03-03T10:35:01Z","pushed_at":"2016-10-14T11:58:48Z","git_url":"git://github.com/nicolas-grekas/composer.git","ssh_url":"git@github.com:nicolas-grekas/composer.git","clone_url":"https://github.com/nicolas-grekas/composer.git","svn_url":"https://github.com/nicolas-grekas/composer","homepage":"http://getcomposer.org/","size":11161,"stargazers_count":0,"watchers_count":0,"language":"PHP","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":"composer:master","ref":"master","sha":"aa051ba4f046487675f4c209e7b87a7306d6aea1","user":{"login":"composer","id":837015,"avatar_url":"https://avatars.githubusercontent.com/u/837015?v=3","gravatar_id":"","url":"https://api.github.com/users/composer","html_url":"https://github.com/composer","followers_url":"https://api.github.com/users/composer/followers","following_url":"https://api.github.com/users/composer/following{/other_user}","gists_url":"https://api.github.com/users/composer/gists{/gist_id}","starred_url":"https://api.github.com/users/composer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/composer/subscriptions","organizations_url":"https://api.github.com/users/composer/orgs","repos_url":"https://api.github.com/users/composer/repos","events_url":"https://api.github.com/users/composer/events{/privacy}","received_events_url":"https://api.github.com/users/composer/received_events","type":"Organization","site_admin":false},"repo":{"id":1864363,"name":"composer","full_name":"composer/composer","owner":{"login":"composer","id":837015,"avatar_url":"https://avatars.githubusercontent.com/u/837015?v=3","gravatar_id":"","url":"https://api.github.com/users/composer","html_url":"https://github.com/composer","followers_url":"https://api.github.com/users/composer/followers","following_url":"https://api.github.com/users/composer/following{/other_user}","gists_url":"https://api.github.com/users/composer/gists{/gist_id}","starred_url":"https://api.github.com/users/composer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/composer/subscriptions","organizations_url":"https://api.github.com/users/composer/orgs","repos_url":"https://api.github.com/users/composer/repos","events_url":"https://api.github.com/users/composer/events{/privacy}","received_events_url":"https://api.github.com/users/composer/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/composer/composer","description":"Dependency Manager for PHP","fork":false,"url":"https://api.github.com/repos/composer/composer","forks_url":"https://api.github.com/repos/composer/composer/forks","keys_url":"https://api.github.com/repos/composer/composer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/composer/composer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/composer/composer/teams","hooks_url":"https://api.github.com/repos/composer/composer/hooks","issue_events_url":"https://api.github.com/repos/composer/composer/issues/events{/number}","events_url":"https://api.github.com/repos/composer/composer/events","assignees_url":"https://api.github.com/repos/composer/composer/assignees{/user}","branches_url":"https://api.github.com/repos/composer/composer/branches{/branch}","tags_url":"https://api.github.com/repos/composer/composer/tags","blobs_url":"https://api.github.com/repos/composer/composer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/composer/composer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/composer/composer/git/refs{/sha}","trees_url":"https://api.github.com/repos/composer/composer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/composer/composer/statuses/{sha}","languages_url":"https://api.github.com/repos/composer/composer/languages","stargazers_url":"https://api.github.com/repos/composer/composer/stargazers","contributors_url":"https://api.github.com/repos/composer/composer/contributors","subscribers_url":"https://api.github.com/repos/composer/composer/subscribers","subscription_url":"https://api.github.com/repos/composer/composer/subscription","commits_url":"https://api.github.com/repos/composer/composer/commits{/sha}","git_commits_url":"https://api.github.com/repos/composer/composer/git/commits{/sha}","comments_url":"https://api.github.com/repos/composer/composer/comments{/number}","issue_comment_url":"https://api.github.com/repos/composer/composer/issues/comments{/number}","contents_url":"https://api.github.com/repos/composer/composer/contents/{+path}","compare_url":"https://api.github.com/repos/composer/composer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/composer/composer/merges","archive_url":"https://api.github.com/repos/composer/composer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/composer/composer/downloads","issues_url":"https://api.github.com/repos/composer/composer/issues{/number}","pulls_url":"https://api.github.com/repos/composer/composer/pulls{/number}","milestones_url":"https://api.github.com/repos/composer/composer/milestones{/number}","notifications_url":"https://api.github.com/repos/composer/composer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/composer/composer/labels{/name}","releases_url":"https://api.github.com/repos/composer/composer/releases{/id}","deployments_url":"https://api.github.com/repos/composer/composer/deployments","created_at":"2011-06-08T08:53:00Z","updated_at":"2016-10-14T09:26:52Z","pushed_at":"2016-10-14T11:58:48Z","git_url":"git://github.com/composer/composer.git","ssh_url":"git@github.com:composer/composer.git","clone_url":"https://github.com/composer/composer.git","svn_url":"https://github.com/composer/composer","homepage":"https://getcomposer.org/","size":22982,"stargazers_count":8324,"watchers_count":8324,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2307,"mirror_url":null,"open_issues_count":194,"forks":2307,"open_issues":194,"watchers":8324,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/composer/composer/pulls/5785"},"html":{"href":"https://github.com/composer/composer/pull/5785"},"issue":{"href":"https://api.github.com/repos/composer/composer/issues/5785"},"comments":{"href":"https://api.github.com/repos/composer/composer/issues/5785/comments"},"review_comments":{"href":"https://api.github.com/repos/composer/composer/pulls/5785/comments"},"review_comment":{"href":"https://api.github.com/repos/composer/composer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/composer/composer/pulls/5785/commits"},"statuses":{"href":"https://api.github.com/repos/composer/composer/statuses/e5e5323d103a8d1c8d088f2fc0751d80354e9007"}}}}
{"actor":{"display_login":"stof"}}