{"action":"created","comment":{"url":"https://api.github.com/repos/symfony/symfony/pulls/comments/89604909","pull_request_review_id":10149165,"id":89604909,"diff_hunk":"@@ -85,15 +85,19 @@ public function load($resource, $type = null)\n         $this->loading = false;\n \n         foreach ($collection->all() as $route) {\n-            if ($controller = $route->getDefault('_controller')) {\n-                try {\n-                    $controller = $this->parser->parse($controller);\n-                } catch (\\InvalidArgumentException $e) {\n-                    // unable to optimize unknown notation\n-                }\n+            $controller = $route->getDefault('_controller');\n+            // If $controller is in class::method notation already skip it for performance.","path":"src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php","position":null,"original_position":20,"commit_id":"cf333f32c567a759cd583025e63849c776eddd6e","original_commit_id":"a588222dc24e72bd92c5a084e3c9318acf8158fc","user":{"login":"enumag","id":539462,"avatar_url":"https://avatars.githubusercontent.com/u/539462?v=3","gravatar_id":"","url":"https://api.github.com/users/enumag","html_url":"https://github.com/enumag","followers_url":"https://api.github.com/users/enumag/followers","following_url":"https://api.github.com/users/enumag/following{/other_user}","gists_url":"https://api.github.com/users/enumag/gists{/gist_id}","starred_url":"https://api.github.com/users/enumag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enumag/subscriptions","organizations_url":"https://api.github.com/users/enumag/orgs","repos_url":"https://api.github.com/users/enumag/repos","events_url":"https://api.github.com/users/enumag/events{/privacy}","received_events_url":"https://api.github.com/users/enumag/received_events","type":"User","site_admin":false},"body":"@nicolas-grekas Understood, done.","created_at":"2016-11-25T11:34:43Z","updated_at":"2016-11-25T11:34:43Z","html_url":"https://github.com/symfony/symfony/pull/20374#discussion_r89604909","pull_request_url":"https://api.github.com/repos/symfony/symfony/pulls/20374","_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments/89604909"},"html":{"href":"https://github.com/symfony/symfony/pull/20374#discussion_r89604909"},"pull_request":{"href":"https://api.github.com/repos/symfony/symfony/pulls/20374"}}},"pull_request":{"url":"https://api.github.com/repos/symfony/symfony/pulls/20374","id":91772171,"html_url":"https://github.com/symfony/symfony/pull/20374","diff_url":"https://github.com/symfony/symfony/pull/20374.diff","patch_url":"https://github.com/symfony/symfony/pull/20374.patch","issue_url":"https://api.github.com/repos/symfony/symfony/issues/20374","number":20374,"state":"open","locked":false,"title":"[FrameworkBundle] Improve performance of ControllerNameParser","user":{"login":"enumag","id":539462,"avatar_url":"https://avatars.githubusercontent.com/u/539462?v=3","gravatar_id":"","url":"https://api.github.com/users/enumag","html_url":"https://github.com/enumag","followers_url":"https://api.github.com/users/enumag/followers","following_url":"https://api.github.com/users/enumag/following{/other_user}","gists_url":"https://api.github.com/users/enumag/gists{/gist_id}","starred_url":"https://api.github.com/users/enumag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enumag/subscriptions","organizations_url":"https://api.github.com/users/enumag/orgs","repos_url":"https://api.github.com/users/enumag/repos","events_url":"https://api.github.com/users/enumag/events{/privacy}","received_events_url":"https://api.github.com/users/enumag/received_events","type":"User","site_admin":false},"body":"| Q             | A\r\n| ------------- | ---\r\n| Branch?       | 2.7\r\n| Bug fix?      | yes\r\n| New feature?  | no\r\n| BC breaks?    | no\r\n| Deprecations? | no\r\n| Tests pass?   | yes\r\n| Fixed tickets | \r\n| License       | MIT\r\n| Doc PR        | \r\n\r\nToday I was searching for bottlenecks in my application using Blackfire. And among other things I found one in Symfony. Blackfire showed that `Symfony\\Bundle\\FrameworkBundle\\Controller\\ControllerNameParser::findAlternative()` was called almost 300 times which took 28 miliseconds.\r\n\r\nIt turns out that `Symfony\\Bundle\\FrameworkBundle\\Routing\\DelegatingLoader::load()` is calling `ControllerNameParser::parse()` without actually needing to do so because `$controller` is in the class::method notation already. `ControllerNameParser` threw an exception, DelegatingLoader caught and ignored it - that's ok. The problem is that generating the exception message took a lot of time because findAlternative is slow. In my case it called the levenshtein function over 5000 times which was completely useless because the exception is ignored anyway.","created_at":"2016-11-01T12:03:48Z","updated_at":"2016-11-25T11:34:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c61a4c8c13f61f700cfe2e994ca6737734f38a0c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/symfony/symfony/pulls/20374/commits","review_comments_url":"https://api.github.com/repos/symfony/symfony/pulls/20374/comments","review_comment_url":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/20374/comments","statuses_url":"https://api.github.com/repos/symfony/symfony/statuses/cf333f32c567a759cd583025e63849c776eddd6e","head":{"label":"enumag:patch-18","ref":"patch-18","sha":"cf333f32c567a759cd583025e63849c776eddd6e","user":{"login":"enumag","id":539462,"avatar_url":"https://avatars.githubusercontent.com/u/539462?v=3","gravatar_id":"","url":"https://api.github.com/users/enumag","html_url":"https://github.com/enumag","followers_url":"https://api.github.com/users/enumag/followers","following_url":"https://api.github.com/users/enumag/following{/other_user}","gists_url":"https://api.github.com/users/enumag/gists{/gist_id}","starred_url":"https://api.github.com/users/enumag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enumag/subscriptions","organizations_url":"https://api.github.com/users/enumag/orgs","repos_url":"https://api.github.com/users/enumag/repos","events_url":"https://api.github.com/users/enumag/events{/privacy}","received_events_url":"https://api.github.com/users/enumag/received_events","type":"User","site_admin":false},"repo":{"id":12350991,"name":"symfony","full_name":"enumag/symfony","owner":{"login":"enumag","id":539462,"avatar_url":"https://avatars.githubusercontent.com/u/539462?v=3","gravatar_id":"","url":"https://api.github.com/users/enumag","html_url":"https://github.com/enumag","followers_url":"https://api.github.com/users/enumag/followers","following_url":"https://api.github.com/users/enumag/following{/other_user}","gists_url":"https://api.github.com/users/enumag/gists{/gist_id}","starred_url":"https://api.github.com/users/enumag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enumag/subscriptions","organizations_url":"https://api.github.com/users/enumag/orgs","repos_url":"https://api.github.com/users/enumag/repos","events_url":"https://api.github.com/users/enumag/events{/privacy}","received_events_url":"https://api.github.com/users/enumag/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/enumag/symfony","description":"The Symfony PHP framework","fork":true,"url":"https://api.github.com/repos/enumag/symfony","forks_url":"https://api.github.com/repos/enumag/symfony/forks","keys_url":"https://api.github.com/repos/enumag/symfony/keys{/key_id}","collaborators_url":"https://api.github.com/repos/enumag/symfony/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/enumag/symfony/teams","hooks_url":"https://api.github.com/repos/enumag/symfony/hooks","issue_events_url":"https://api.github.com/repos/enumag/symfony/issues/events{/number}","events_url":"https://api.github.com/repos/enumag/symfony/events","assignees_url":"https://api.github.com/repos/enumag/symfony/assignees{/user}","branches_url":"https://api.github.com/repos/enumag/symfony/branches{/branch}","tags_url":"https://api.github.com/repos/enumag/symfony/tags","blobs_url":"https://api.github.com/repos/enumag/symfony/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/enumag/symfony/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/enumag/symfony/git/refs{/sha}","trees_url":"https://api.github.com/repos/enumag/symfony/git/trees{/sha}","statuses_url":"https://api.github.com/repos/enumag/symfony/statuses/{sha}","languages_url":"https://api.github.com/repos/enumag/symfony/languages","stargazers_url":"https://api.github.com/repos/enumag/symfony/stargazers","contributors_url":"https://api.github.com/repos/enumag/symfony/contributors","subscribers_url":"https://api.github.com/repos/enumag/symfony/subscribers","subscription_url":"https://api.github.com/repos/enumag/symfony/subscription","commits_url":"https://api.github.com/repos/enumag/symfony/commits{/sha}","git_commits_url":"https://api.github.com/repos/enumag/symfony/git/commits{/sha}","comments_url":"https://api.github.com/repos/enumag/symfony/comments{/number}","issue_comment_url":"https://api.github.com/repos/enumag/symfony/issues/comments{/number}","contents_url":"https://api.github.com/repos/enumag/symfony/contents/{+path}","compare_url":"https://api.github.com/repos/enumag/symfony/compare/{base}...{head}","merges_url":"https://api.github.com/repos/enumag/symfony/merges","archive_url":"https://api.github.com/repos/enumag/symfony/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/enumag/symfony/downloads","issues_url":"https://api.github.com/repos/enumag/symfony/issues{/number}","pulls_url":"https://api.github.com/repos/enumag/symfony/pulls{/number}","milestones_url":"https://api.github.com/repos/enumag/symfony/milestones{/number}","notifications_url":"https://api.github.com/repos/enumag/symfony/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/enumag/symfony/labels{/name}","releases_url":"https://api.github.com/repos/enumag/symfony/releases{/id}","deployments_url":"https://api.github.com/repos/enumag/symfony/deployments","created_at":"2013-08-24T22:46:02Z","updated_at":"2013-09-09T12:26:46Z","pushed_at":"2016-11-25T11:34:20Z","git_url":"git://github.com/enumag/symfony.git","ssh_url":"git@github.com:enumag/symfony.git","clone_url":"https://github.com/enumag/symfony.git","svn_url":"https://github.com/enumag/symfony","homepage":"symfony.com","size":73702,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":false,"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":"symfony:2.7","ref":"2.7","sha":"b550d7ebd880a011098a40ab67350b841ee55af5","user":{"login":"symfony","id":143937,"avatar_url":"https://avatars.githubusercontent.com/u/143937?v=3","gravatar_id":"","url":"https://api.github.com/users/symfony","html_url":"https://github.com/symfony","followers_url":"https://api.github.com/users/symfony/followers","following_url":"https://api.github.com/users/symfony/following{/other_user}","gists_url":"https://api.github.com/users/symfony/gists{/gist_id}","starred_url":"https://api.github.com/users/symfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symfony/subscriptions","organizations_url":"https://api.github.com/users/symfony/orgs","repos_url":"https://api.github.com/users/symfony/repos","events_url":"https://api.github.com/users/symfony/events{/privacy}","received_events_url":"https://api.github.com/users/symfony/received_events","type":"Organization","site_admin":false},"repo":{"id":458058,"name":"symfony","full_name":"symfony/symfony","owner":{"login":"symfony","id":143937,"avatar_url":"https://avatars.githubusercontent.com/u/143937?v=3","gravatar_id":"","url":"https://api.github.com/users/symfony","html_url":"https://github.com/symfony","followers_url":"https://api.github.com/users/symfony/followers","following_url":"https://api.github.com/users/symfony/following{/other_user}","gists_url":"https://api.github.com/users/symfony/gists{/gist_id}","starred_url":"https://api.github.com/users/symfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symfony/subscriptions","organizations_url":"https://api.github.com/users/symfony/orgs","repos_url":"https://api.github.com/users/symfony/repos","events_url":"https://api.github.com/users/symfony/events{/privacy}","received_events_url":"https://api.github.com/users/symfony/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/symfony/symfony","description":"The Symfony PHP framework","fork":false,"url":"https://api.github.com/repos/symfony/symfony","forks_url":"https://api.github.com/repos/symfony/symfony/forks","keys_url":"https://api.github.com/repos/symfony/symfony/keys{/key_id}","collaborators_url":"https://api.github.com/repos/symfony/symfony/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/symfony/symfony/teams","hooks_url":"https://api.github.com/repos/symfony/symfony/hooks","issue_events_url":"https://api.github.com/repos/symfony/symfony/issues/events{/number}","events_url":"https://api.github.com/repos/symfony/symfony/events","assignees_url":"https://api.github.com/repos/symfony/symfony/assignees{/user}","branches_url":"https://api.github.com/repos/symfony/symfony/branches{/branch}","tags_url":"https://api.github.com/repos/symfony/symfony/tags","blobs_url":"https://api.github.com/repos/symfony/symfony/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/symfony/symfony/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/symfony/symfony/git/refs{/sha}","trees_url":"https://api.github.com/repos/symfony/symfony/git/trees{/sha}","statuses_url":"https://api.github.com/repos/symfony/symfony/statuses/{sha}","languages_url":"https://api.github.com/repos/symfony/symfony/languages","stargazers_url":"https://api.github.com/repos/symfony/symfony/stargazers","contributors_url":"https://api.github.com/repos/symfony/symfony/contributors","subscribers_url":"https://api.github.com/repos/symfony/symfony/subscribers","subscription_url":"https://api.github.com/repos/symfony/symfony/subscription","commits_url":"https://api.github.com/repos/symfony/symfony/commits{/sha}","git_commits_url":"https://api.github.com/repos/symfony/symfony/git/commits{/sha}","comments_url":"https://api.github.com/repos/symfony/symfony/comments{/number}","issue_comment_url":"https://api.github.com/repos/symfony/symfony/issues/comments{/number}","contents_url":"https://api.github.com/repos/symfony/symfony/contents/{+path}","compare_url":"https://api.github.com/repos/symfony/symfony/compare/{base}...{head}","merges_url":"https://api.github.com/repos/symfony/symfony/merges","archive_url":"https://api.github.com/repos/symfony/symfony/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/symfony/symfony/downloads","issues_url":"https://api.github.com/repos/symfony/symfony/issues{/number}","pulls_url":"https://api.github.com/repos/symfony/symfony/pulls{/number}","milestones_url":"https://api.github.com/repos/symfony/symfony/milestones{/number}","notifications_url":"https://api.github.com/repos/symfony/symfony/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/symfony/symfony/labels{/name}","releases_url":"https://api.github.com/repos/symfony/symfony/releases{/id}","deployments_url":"https://api.github.com/repos/symfony/symfony/deployments","created_at":"2010-01-04T14:21:21Z","updated_at":"2016-11-25T10:43:39Z","pushed_at":"2016-11-25T11:34:22Z","git_url":"git://github.com/symfony/symfony.git","ssh_url":"git@github.com:symfony/symfony.git","clone_url":"https://github.com/symfony/symfony.git","svn_url":"https://github.com/symfony/symfony","homepage":"symfony.com","size":143131,"stargazers_count":13338,"watchers_count":13338,"language":"PHP","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":5138,"mirror_url":null,"open_issues_count":817,"forks":5138,"open_issues":817,"watchers":13338,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/20374"},"html":{"href":"https://github.com/symfony/symfony/pull/20374"},"issue":{"href":"https://api.github.com/repos/symfony/symfony/issues/20374"},"comments":{"href":"https://api.github.com/repos/symfony/symfony/issues/20374/comments"},"review_comments":{"href":"https://api.github.com/repos/symfony/symfony/pulls/20374/comments"},"review_comment":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/symfony/symfony/pulls/20374/commits"},"statuses":{"href":"https://api.github.com/repos/symfony/symfony/statuses/cf333f32c567a759cd583025e63849c776eddd6e"}}}}
{"actor":{"display_login":"enumag"}}