{"action":"created","comment":{"url":"https://api.github.com/repos/composer/composer/pulls/comments/34280960","id":34280960,"diff_hunk":"@@ -29,63 +29,50 @@ class Rule\n     const RULE_LEARNED = 12;\n     const RULE_PACKAGE_ALIAS = 13;\n \n+    const BITFIELD_TYPE = 0;\n+    const BITFIELD_REASON = 8;\n+    const BITFIELD_DISABLED = 16;\n+\n     /**\n      * READ-ONLY: The literals this rule consists of.\n      * @var array\n      */\n     public $literals;\n \n-    protected $disabled;\n-    protected $type;\n-    protected $id;\n-    protected $reason;\n+    protected $bitfield;\n     protected $reasonData;\n \n-    protected $job;\n-\n-    protected $ruleHash;\n-\n     public function __construct(array $literals, $reason, $reasonData, $job = null)\n     {\n         // sort all packages ascending by id\n         sort($literals);\n \n         $this->literals = $literals;\n-        $this->reason = $reason;\n         $this->reasonData = $reasonData;\n \n-        $this->disabled = false;\n-\n-        $this->job = $job;\n-\n-        $this->type = -1;\n+        if ($job) {","path":"src/Composer/DependencyResolver/Rule.php","position":39,"original_position":39,"commit_id":"f535542fcac3365ca8f237874070bd54e9085d52","original_commit_id":"f535542fcac3365ca8f237874070bd54e9085d52","user":{"login":"staabm","id":120441,"avatar_url":"https://avatars.githubusercontent.com/u/120441?v=3","gravatar_id":"","url":"https://api.github.com/users/staabm","html_url":"https://github.com/staabm","followers_url":"https://api.github.com/users/staabm/followers","following_url":"https://api.github.com/users/staabm/following{/other_user}","gists_url":"https://api.github.com/users/staabm/gists{/gist_id}","starred_url":"https://api.github.com/users/staabm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/staabm/subscriptions","organizations_url":"https://api.github.com/users/staabm/orgs","repos_url":"https://api.github.com/users/staabm/repos","events_url":"https://api.github.com/users/staabm/events{/privacy}","received_events_url":"https://api.github.com/users/staabm/received_events","type":"User","site_admin":false},"body":"This if is unnecessary","created_at":"2015-07-09T17:34:19Z","updated_at":"2015-07-09T17:34:19Z","html_url":"https://github.com/composer/composer/pull/4239#discussion_r34280960","pull_request_url":"https://api.github.com/repos/composer/composer/pulls/4239","_links":{"self":{"href":"https://api.github.com/repos/composer/composer/pulls/comments/34280960"},"html":{"href":"https://github.com/composer/composer/pull/4239#discussion_r34280960"},"pull_request":{"href":"https://api.github.com/repos/composer/composer/pulls/4239"}}},"pull_request":{"url":"https://api.github.com/repos/composer/composer/pulls/4239","id":39603826,"html_url":"https://github.com/composer/composer/pull/4239","diff_url":"https://github.com/composer/composer/pull/4239.diff","patch_url":"https://github.com/composer/composer/pull/4239.patch","issue_url":"https://api.github.com/repos/composer/composer/issues/4239","number":4239,"state":"open","locked":false,"title":"Reduce memory usage of Rule objects","user":{"login":"naderman","id":154844,"avatar_url":"https://avatars.githubusercontent.com/u/154844?v=3","gravatar_id":"","url":"https://api.github.com/users/naderman","html_url":"https://github.com/naderman","followers_url":"https://api.github.com/users/naderman/followers","following_url":"https://api.github.com/users/naderman/following{/other_user}","gists_url":"https://api.github.com/users/naderman/gists{/gist_id}","starred_url":"https://api.github.com/users/naderman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naderman/subscriptions","organizations_url":"https://api.github.com/users/naderman/orgs","repos_url":"https://api.github.com/users/naderman/repos","events_url":"https://api.github.com/users/naderman/events{/privacy}","received_events_url":"https://api.github.com/users/naderman/received_events","type":"User","site_admin":false},"body":"Storing the Rule data in a bitfield and getting rid of their id values saves up to 10% of memory.\r\n\r\nThis PR includes the commits from the rule hash changes in https://github.com/composer/composer/pull/4234\r\n\r\nComparison before/after: \r\n- Composer:\r\n```\r\n[96.2MB/1.63s] Analyzed 15693 rules to resolve dependencies\r\n[67.7MB/1.80s] Memory usage: 67.7MB (peak: 96.48MB), time: 1.8s\r\n\r\n[90.9MB/1.72s] Analyzed 15693 rules to resolve dependencies\r\n[67.1MB/1.87s] Memory usage: 67.09MB (peak: 91.17MB), time: 1.87s\r\n```\r\n- Packagist:\r\n```\r\n[429.2MB/9.40s] Analyzed 144469 rules to resolve dependencies\r\n[157.1MB/9.97s] Memory usage: 157.1MB (peak: 429.89MB), time: 9.97s\r\n\r\n[386.0MB/10.05s] Analyzed 144469 rules to resolve dependencies\r\n[157.1MB/10.52s] Memory usage: 157.09MB (peak: 386.64MB), time: 10.52s\r\n```\r\n- Symfony Standard:\r\n```\r\n[328.9MB/7.58s] Analyzed 94972 rules to resolve dependencies\r\n[148.9MB/7.99s] Memory usage: 148.9MB (peak: 329.47MB), time: 7.99s\r\n\r\n[299.4MB/7.15s] Analyzed 94972 rules to resolve dependencies\r\n[148.3MB/7.69s] Memory usage: 148.35MB (peak: 299.88MB), time: 7.69s\r\n```\r\n","created_at":"2015-07-09T16:43:36Z","updated_at":"2015-07-09T17:34:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"34ced0b07e46bb68b8f9f967a989a0ddb671172f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/composer/composer/pulls/4239/commits","review_comments_url":"https://api.github.com/repos/composer/composer/pulls/4239/comments","review_comment_url":"https://api.github.com/repos/composer/composer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/composer/composer/issues/4239/comments","statuses_url":"https://api.github.com/repos/composer/composer/statuses/f535542fcac3365ca8f237874070bd54e9085d52","head":{"label":"naderman:memory-rules","ref":"memory-rules","sha":"f535542fcac3365ca8f237874070bd54e9085d52","user":{"login":"naderman","id":154844,"avatar_url":"https://avatars.githubusercontent.com/u/154844?v=3","gravatar_id":"","url":"https://api.github.com/users/naderman","html_url":"https://github.com/naderman","followers_url":"https://api.github.com/users/naderman/followers","following_url":"https://api.github.com/users/naderman/following{/other_user}","gists_url":"https://api.github.com/users/naderman/gists{/gist_id}","starred_url":"https://api.github.com/users/naderman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naderman/subscriptions","organizations_url":"https://api.github.com/users/naderman/orgs","repos_url":"https://api.github.com/users/naderman/repos","events_url":"https://api.github.com/users/naderman/events{/privacy}","received_events_url":"https://api.github.com/users/naderman/received_events","type":"User","site_admin":false},"repo":{"id":2017619,"name":"composer","full_name":"naderman/composer","owner":{"login":"naderman","id":154844,"avatar_url":"https://avatars.githubusercontent.com/u/154844?v=3","gravatar_id":"","url":"https://api.github.com/users/naderman","html_url":"https://github.com/naderman","followers_url":"https://api.github.com/users/naderman/followers","following_url":"https://api.github.com/users/naderman/following{/other_user}","gists_url":"https://api.github.com/users/naderman/gists{/gist_id}","starred_url":"https://api.github.com/users/naderman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naderman/subscriptions","organizations_url":"https://api.github.com/users/naderman/orgs","repos_url":"https://api.github.com/users/naderman/repos","events_url":"https://api.github.com/users/naderman/events{/privacy}","received_events_url":"https://api.github.com/users/naderman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/naderman/composer","description":"Package Manager for PHP","fork":true,"url":"https://api.github.com/repos/naderman/composer","forks_url":"https://api.github.com/repos/naderman/composer/forks","keys_url":"https://api.github.com/repos/naderman/composer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/naderman/composer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/naderman/composer/teams","hooks_url":"https://api.github.com/repos/naderman/composer/hooks","issue_events_url":"https://api.github.com/repos/naderman/composer/issues/events{/number}","events_url":"https://api.github.com/repos/naderman/composer/events","assignees_url":"https://api.github.com/repos/naderman/composer/assignees{/user}","branches_url":"https://api.github.com/repos/naderman/composer/branches{/branch}","tags_url":"https://api.github.com/repos/naderman/composer/tags","blobs_url":"https://api.github.com/repos/naderman/composer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/naderman/composer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/naderman/composer/git/refs{/sha}","trees_url":"https://api.github.com/repos/naderman/composer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/naderman/composer/statuses/{sha}","languages_url":"https://api.github.com/repos/naderman/composer/languages","stargazers_url":"https://api.github.com/repos/naderman/composer/stargazers","contributors_url":"https://api.github.com/repos/naderman/composer/contributors","subscribers_url":"https://api.github.com/repos/naderman/composer/subscribers","subscription_url":"https://api.github.com/repos/naderman/composer/subscription","commits_url":"https://api.github.com/repos/naderman/composer/commits{/sha}","git_commits_url":"https://api.github.com/repos/naderman/composer/git/commits{/sha}","comments_url":"https://api.github.com/repos/naderman/composer/comments{/number}","issue_comment_url":"https://api.github.com/repos/naderman/composer/issues/comments{/number}","contents_url":"https://api.github.com/repos/naderman/composer/contents/{+path}","compare_url":"https://api.github.com/repos/naderman/composer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/naderman/composer/merges","archive_url":"https://api.github.com/repos/naderman/composer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/naderman/composer/downloads","issues_url":"https://api.github.com/repos/naderman/composer/issues{/number}","pulls_url":"https://api.github.com/repos/naderman/composer/pulls{/number}","milestones_url":"https://api.github.com/repos/naderman/composer/milestones{/number}","notifications_url":"https://api.github.com/repos/naderman/composer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/naderman/composer/labels{/name}","releases_url":"https://api.github.com/repos/naderman/composer/releases{/id}","created_at":"2011-07-08T12:05:29Z","updated_at":"2014-12-03T15:21:17Z","pushed_at":"2015-07-09T16:59:37Z","git_url":"git://github.com/naderman/composer.git","ssh_url":"git@github.com:naderman/composer.git","clone_url":"https://github.com/naderman/composer.git","svn_url":"https://github.com/naderman/composer","homepage":"","size":12292,"stargazers_count":2,"watchers_count":2,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":0,"forks":2,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"composer:master","ref":"master","sha":"39e6f51bef3a4b148d9f35a0ae7a082e9aed97f4","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}","created_at":"2011-06-08T08:53:00Z","updated_at":"2015-07-09T10:47:24Z","pushed_at":"2015-07-09T16:59:38Z","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":"http://getcomposer.org/","size":27226,"stargazers_count":5955,"watchers_count":5955,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1642,"mirror_url":null,"open_issues_count":562,"forks":1642,"open_issues":562,"watchers":5955,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/composer/composer/pulls/4239"},"html":{"href":"https://github.com/composer/composer/pull/4239"},"issue":{"href":"https://api.github.com/repos/composer/composer/issues/4239"},"comments":{"href":"https://api.github.com/repos/composer/composer/issues/4239/comments"},"review_comments":{"href":"https://api.github.com/repos/composer/composer/pulls/4239/comments"},"review_comment":{"href":"https://api.github.com/repos/composer/composer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/composer/composer/pulls/4239/commits"},"statuses":{"href":"https://api.github.com/repos/composer/composer/statuses/f535542fcac3365ca8f237874070bd54e9085d52"}}}}