{"action":"created","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/26736","repository_url":"https://api.github.com/repos/symfony/symfony","labels_url":"https://api.github.com/repos/symfony/symfony/issues/26736/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/26736/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/26736/events","html_url":"https://github.com/symfony/symfony/issues/26736","id":310349484,"node_id":"MDU6SXNzdWUzMTAzNDk0ODQ=","number":26736,"title":"Autowiring is very slow for large excluded directories","user":{"login":"glynnforrest","id":578458,"node_id":"MDQ6VXNlcjU3ODQ1OA==","avatar_url":"https://avatars2.githubusercontent.com/u/578458?v=4","gravatar_id":"","url":"https://api.github.com/users/glynnforrest","html_url":"https://github.com/glynnforrest","followers_url":"https://api.github.com/users/glynnforrest/followers","following_url":"https://api.github.com/users/glynnforrest/following{/other_user}","gists_url":"https://api.github.com/users/glynnforrest/gists{/gist_id}","starred_url":"https://api.github.com/users/glynnforrest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glynnforrest/subscriptions","organizations_url":"https://api.github.com/users/glynnforrest/orgs","repos_url":"https://api.github.com/users/glynnforrest/repos","events_url":"https://api.github.com/users/glynnforrest/events{/privacy}","received_events_url":"https://api.github.com/users/glynnforrest/received_events","type":"User","site_admin":false},"labels":[{"id":100079,"node_id":"MDU6TGFiZWwxMDAwNzk=","url":"https://api.github.com/repos/symfony/symfony/labels/Bug","name":"Bug","color":"e10c02","default":false},{"id":99863,"node_id":"MDU6TGFiZWw5OTg2Mw==","url":"https://api.github.com/repos/symfony/symfony/labels/DependencyInjection","name":"DependencyInjection","color":"DDDDDD","default":false},{"id":237003792,"node_id":"MDU6TGFiZWwyMzcwMDM3OTI=","url":"https://api.github.com/repos/symfony/symfony/labels/Status:%20Needs%20Review","name":"Status: Needs Review","color":"ededed","default":false},{"id":844722949,"node_id":"MDU6TGFiZWw4NDQ3MjI5NDk=","url":"https://api.github.com/repos/symfony/symfony/labels/help%20wanted","name":"help wanted","color":"0e8a16","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/symfony/symfony/milestones/10","html_url":"https://github.com/symfony/symfony/milestone/10","labels_url":"https://api.github.com/repos/symfony/symfony/milestones/10/labels","id":2117464,"node_id":"MDk6TWlsZXN0b25lMjExNzQ2NA==","number":10,"title":"3.4","description":"https://symfony.com/roadmap?version=3.4#checker","creator":{"login":"javiereguiluz","id":73419,"node_id":"MDQ6VXNlcjczNDE5","avatar_url":"https://avatars3.githubusercontent.com/u/73419?v=4","gravatar_id":"","url":"https://api.github.com/users/javiereguiluz","html_url":"https://github.com/javiereguiluz","followers_url":"https://api.github.com/users/javiereguiluz/followers","following_url":"https://api.github.com/users/javiereguiluz/following{/other_user}","gists_url":"https://api.github.com/users/javiereguiluz/gists{/gist_id}","starred_url":"https://api.github.com/users/javiereguiluz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javiereguiluz/subscriptions","organizations_url":"https://api.github.com/users/javiereguiluz/orgs","repos_url":"https://api.github.com/users/javiereguiluz/repos","events_url":"https://api.github.com/users/javiereguiluz/events{/privacy}","received_events_url":"https://api.github.com/users/javiereguiluz/received_events","type":"User","site_admin":false},"open_issues":20,"closed_issues":873,"state":"open","created_at":"2016-11-06T20:24:23Z","updated_at":"2018-07-13T15:07:06Z","due_on":"2020-11-30T08:00:00Z","closed_at":null},"comments":17,"created_at":"2018-04-01T19:59:08Z","updated_at":"2018-07-16T08:30:41Z","closed_at":null,"author_association":"NONE","body":"| Q                | A\r\n| ---------------- | -----\r\n| Bug report?      | yes\r\n| Feature request? | no\r\n| BC Break report? | no\r\n| RFC?             | no\r\n| Symfony version  | 3.4.*\r\n\r\nI'm experiencing a significant slowdown from autowiring when there are large directories in a bundle (e.g. `node_modules`), even when those directories are excluded.\r\n\r\nThis configuration is slow:\r\n```yaml\r\nservices:\r\n    _defaults:\r\n        autowire: true\r\n        autoconfigure: true\r\n        public: false\r\n\r\n    AppBundle\\:\r\n        resource: '../../src/AppBundle/*'\r\n        exclude: '../../src/AppBundle/{Entity,Resources,Repository,Tests,node_modules}'\r\n```\r\n\r\nThis one isn't, but has the downside of adding each directory to `resource` manually.\r\n```yaml\r\nservices:\r\n    _defaults:\r\n        autowire: true\r\n        autoconfigure: true\r\n        public: false\r\n\r\n    AppBundle\\:\r\n        resource: '../../src/AppBundle/{Publisher,Locator,Foo,Bar}'\r\n```\r\n\r\nMy poorly educated guess is that the GlobResource in the config component iterates through all the possibilities first, before they are filtered out by the exclude pattern? This would explain the slowdown.\r\n\r\nhttps://github.com/symfony/symfony/blob/b3fc3b569003ea9454449391a01d516d0a560f9a/src/Symfony/Component/Config/Resource/GlobResource.php#L97\r\n\r\nDo you think it would be possible to prevent the glob loader searching through excluded directories?\r\n\r\nThe problem is so bad that I occasionally get out of memory errors in dev:\r\n```\r\n[Sun Apr 01 19:24:47.554299 2018] [:error] [pid 4298] [client 192.168.10.1:62972] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 130968 bytes) in /var/www/project/vendor/symfony/config/Resource/GlobResource.php on line 105\r\n```\r\n\r\nThanks very much for adding autowiring to Symfony. It has made development so much faster! 🎉 "},"comment":{"url":"https://api.github.com/repos/symfony/symfony/issues/comments/405179130","html_url":"https://github.com/symfony/symfony/issues/26736#issuecomment-405179130","issue_url":"https://api.github.com/repos/symfony/symfony/issues/26736","id":405179130,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNTE3OTEzMA==","user":{"login":"gonzalovilaseca","id":4030438,"node_id":"MDQ6VXNlcjQwMzA0Mzg=","avatar_url":"https://avatars0.githubusercontent.com/u/4030438?v=4","gravatar_id":"","url":"https://api.github.com/users/gonzalovilaseca","html_url":"https://github.com/gonzalovilaseca","followers_url":"https://api.github.com/users/gonzalovilaseca/followers","following_url":"https://api.github.com/users/gonzalovilaseca/following{/other_user}","gists_url":"https://api.github.com/users/gonzalovilaseca/gists{/gist_id}","starred_url":"https://api.github.com/users/gonzalovilaseca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonzalovilaseca/subscriptions","organizations_url":"https://api.github.com/users/gonzalovilaseca/orgs","repos_url":"https://api.github.com/users/gonzalovilaseca/repos","events_url":"https://api.github.com/users/gonzalovilaseca/events{/privacy}","received_events_url":"https://api.github.com/users/gonzalovilaseca/received_events","type":"User","site_admin":false},"created_at":"2018-07-16T08:30:41Z","updated_at":"2018-07-16T08:30:41Z","author_association":"CONTRIBUTOR","body":"@glynnforrest Wonderful, thanks, will try to add tests and do a proper PR now."}}
{"actor":{"display_login":"gonzalovilaseca"}}