{"action":"created","comment":{"url":"https://api.github.com/repos/aspnet/Razor/pulls/comments/65269698","id":65269698,"diff_hunk":"@@ -93,30 +94,33 @@ protected override void Visit(TagHelperChunk chunk)\n \n             if (!Context.Host.DesignTimeMode)\n             {\n-                PreAllocateUnboundTagHelperAttributes(chunk);\n+                PreAllocateTagHelperAttributes(chunk);\n             }\n \n             // We need to dive deeper to ensure we pick up any nested tag helpers.\n             Accept(chunk.Children);\n         }\n \n-        private void PreAllocateUnboundTagHelperAttributes(TagHelperChunk chunk)\n+        private void PreAllocateTagHelperAttributes(TagHelperChunk chunk)\n         {\n             var boundAttributes = new HashSet<string>(StringComparer.OrdinalIgnoreCase);\n             for (var i = 0; i < chunk.Attributes.Count; i++)\n             {\n                 var attribute = chunk.Attributes[i];\n-                var hasAssociatedDescriptors = chunk.Descriptors.Any(descriptor =>\n+                var associatedDescriptors = chunk.Descriptors.Where(descriptor =>\n                     descriptor.Attributes.Any(attributeDescriptor => attributeDescriptor.IsNameMatch(attribute.Key)));\n \n                 // If there's no descriptors associated or we're hitting a bound attribute a second time.\n-                if (!hasAssociatedDescriptors || !boundAttributes.Add(attribute.Key))\n+                var isUnBoundAttribute = !associatedDescriptors.Any() || !boundAttributes.Add(attribute.Key);\n+\n+                // Perf: We will preallocate TagHelperAttribute for unbound attributes and bound string valued attributes.","path":"src/Microsoft.AspNetCore.Razor/CodeGenerators/Visitors/CSharpTagHelperFieldDeclarationVisitor.cs","position":35,"original_position":35,"commit_id":"89bd7a6bc481f8187a44788f31da9ef250ab970e","original_commit_id":"89bd7a6bc481f8187a44788f31da9ef250ab970e","user":{"login":"NTaylorMullen","id":2008729,"avatar_url":"https://avatars.githubusercontent.com/u/2008729?v=3","gravatar_id":"","url":"https://api.github.com/users/NTaylorMullen","html_url":"https://github.com/NTaylorMullen","followers_url":"https://api.github.com/users/NTaylorMullen/followers","following_url":"https://api.github.com/users/NTaylorMullen/following{/other_user}","gists_url":"https://api.github.com/users/NTaylorMullen/gists{/gist_id}","starred_url":"https://api.github.com/users/NTaylorMullen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NTaylorMullen/subscriptions","organizations_url":"https://api.github.com/users/NTaylorMullen/orgs","repos_url":"https://api.github.com/users/NTaylorMullen/repos","events_url":"https://api.github.com/users/NTaylorMullen/events{/privacy}","received_events_url":"https://api.github.com/users/NTaylorMullen/received_events","type":"User","site_admin":false},"body":"`and simple bound string valued attributes.`","created_at":"2016-05-31T21:52:28Z","updated_at":"2016-05-31T21:52:28Z","html_url":"https://github.com/aspnet/Razor/pull/765#discussion_r65269698","pull_request_url":"https://api.github.com/repos/aspnet/Razor/pulls/765","_links":{"self":{"href":"https://api.github.com/repos/aspnet/Razor/pulls/comments/65269698"},"html":{"href":"https://github.com/aspnet/Razor/pull/765#discussion_r65269698"},"pull_request":{"href":"https://api.github.com/repos/aspnet/Razor/pulls/765"}}},"pull_request":{"url":"https://api.github.com/repos/aspnet/Razor/pulls/765","id":71644818,"html_url":"https://github.com/aspnet/Razor/pull/765","diff_url":"https://github.com/aspnet/Razor/pull/765.diff","patch_url":"https://github.com/aspnet/Razor/pull/765.patch","issue_url":"https://api.github.com/repos/aspnet/Razor/issues/765","number":765,"state":"open","locked":false,"title":"[Perf] Preallocate TagHelperAttributes for bound string typed attributes","user":{"login":"mnltejaswini","id":8011073,"avatar_url":"https://avatars.githubusercontent.com/u/8011073?v=3","gravatar_id":"","url":"https://api.github.com/users/mnltejaswini","html_url":"https://github.com/mnltejaswini","followers_url":"https://api.github.com/users/mnltejaswini/followers","following_url":"https://api.github.com/users/mnltejaswini/following{/other_user}","gists_url":"https://api.github.com/users/mnltejaswini/gists{/gist_id}","starred_url":"https://api.github.com/users/mnltejaswini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnltejaswini/subscriptions","organizations_url":"https://api.github.com/users/mnltejaswini/orgs","repos_url":"https://api.github.com/users/mnltejaswini/repos","events_url":"https://api.github.com/users/mnltejaswini/events{/privacy}","received_events_url":"https://api.github.com/users/mnltejaswini/received_events","type":"User","site_admin":false},"body":"Fixes #704 \r\nScenario: https://github.com/aspnet/Mvc/issues/4593 \r\n\r\nThe number of TagHelperAttributes allocated  reduced by 50% before and after optimization. \r\nBefore optimization\r\n-------------------------\r\n![image](https://cloud.githubusercontent.com/assets/8011073/15623063/8bac2630-2424-11e6-8881-87d3eb2ba4ef.png)\r\n\r\n\r\nAfter optimization\r\n---------------------\r\n![image](https://cloud.githubusercontent.com/assets/8011073/15623078/c0d707ee-2424-11e6-805e-4a5804236c98.png)\r\n\r\n\r\nTotal savings is number of bytes allocated is 1.3%\r\n","created_at":"2016-05-27T00:27:15Z","updated_at":"2016-05-31T21:52:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dc43c599b9c311fc49f00b6bfcd4a5408d76338e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/aspnet/Razor/pulls/765/commits","review_comments_url":"https://api.github.com/repos/aspnet/Razor/pulls/765/comments","review_comment_url":"https://api.github.com/repos/aspnet/Razor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aspnet/Razor/issues/765/comments","statuses_url":"https://api.github.com/repos/aspnet/Razor/statuses/89bd7a6bc481f8187a44788f31da9ef250ab970e","head":{"label":"aspnet:naduggar/Preallocate","ref":"naduggar/Preallocate","sha":"89bd7a6bc481f8187a44788f31da9ef250ab970e","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":15835991,"name":"Razor","full_name":"aspnet/Razor","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/Razor","description":"Parser and code generator for CSHTML files used in view pages for MVC web apps.","fork":false,"url":"https://api.github.com/repos/aspnet/Razor","forks_url":"https://api.github.com/repos/aspnet/Razor/forks","keys_url":"https://api.github.com/repos/aspnet/Razor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/Razor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/Razor/teams","hooks_url":"https://api.github.com/repos/aspnet/Razor/hooks","issue_events_url":"https://api.github.com/repos/aspnet/Razor/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/Razor/events","assignees_url":"https://api.github.com/repos/aspnet/Razor/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/Razor/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/Razor/tags","blobs_url":"https://api.github.com/repos/aspnet/Razor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/Razor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/Razor/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/Razor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/Razor/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/Razor/languages","stargazers_url":"https://api.github.com/repos/aspnet/Razor/stargazers","contributors_url":"https://api.github.com/repos/aspnet/Razor/contributors","subscribers_url":"https://api.github.com/repos/aspnet/Razor/subscribers","subscription_url":"https://api.github.com/repos/aspnet/Razor/subscription","commits_url":"https://api.github.com/repos/aspnet/Razor/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/Razor/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/Razor/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/Razor/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/Razor/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/Razor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/Razor/merges","archive_url":"https://api.github.com/repos/aspnet/Razor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/Razor/downloads","issues_url":"https://api.github.com/repos/aspnet/Razor/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/Razor/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/Razor/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/Razor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/Razor/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/Razor/releases{/id}","deployments_url":"https://api.github.com/repos/aspnet/Razor/deployments","created_at":"2014-01-12T03:52:46Z","updated_at":"2016-05-31T10:28:44Z","pushed_at":"2016-05-31T21:10:35Z","git_url":"git://github.com/aspnet/Razor.git","ssh_url":"git@github.com:aspnet/Razor.git","clone_url":"https://github.com/aspnet/Razor.git","svn_url":"https://github.com/aspnet/Razor","homepage":"","size":7222,"stargazers_count":519,"watchers_count":519,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":149,"mirror_url":null,"open_issues_count":98,"forks":149,"open_issues":98,"watchers":519,"default_branch":"dev"}},"base":{"label":"aspnet:dev","ref":"dev","sha":"bde78dc3d46c6ca9736c1a7a30d1fa8cb068ebb6","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":15835991,"name":"Razor","full_name":"aspnet/Razor","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/Razor","description":"Parser and code generator for CSHTML files used in view pages for MVC web apps.","fork":false,"url":"https://api.github.com/repos/aspnet/Razor","forks_url":"https://api.github.com/repos/aspnet/Razor/forks","keys_url":"https://api.github.com/repos/aspnet/Razor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/Razor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/Razor/teams","hooks_url":"https://api.github.com/repos/aspnet/Razor/hooks","issue_events_url":"https://api.github.com/repos/aspnet/Razor/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/Razor/events","assignees_url":"https://api.github.com/repos/aspnet/Razor/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/Razor/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/Razor/tags","blobs_url":"https://api.github.com/repos/aspnet/Razor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/Razor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/Razor/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/Razor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/Razor/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/Razor/languages","stargazers_url":"https://api.github.com/repos/aspnet/Razor/stargazers","contributors_url":"https://api.github.com/repos/aspnet/Razor/contributors","subscribers_url":"https://api.github.com/repos/aspnet/Razor/subscribers","subscription_url":"https://api.github.com/repos/aspnet/Razor/subscription","commits_url":"https://api.github.com/repos/aspnet/Razor/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/Razor/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/Razor/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/Razor/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/Razor/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/Razor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/Razor/merges","archive_url":"https://api.github.com/repos/aspnet/Razor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/Razor/downloads","issues_url":"https://api.github.com/repos/aspnet/Razor/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/Razor/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/Razor/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/Razor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/Razor/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/Razor/releases{/id}","deployments_url":"https://api.github.com/repos/aspnet/Razor/deployments","created_at":"2014-01-12T03:52:46Z","updated_at":"2016-05-31T10:28:44Z","pushed_at":"2016-05-31T21:10:35Z","git_url":"git://github.com/aspnet/Razor.git","ssh_url":"git@github.com:aspnet/Razor.git","clone_url":"https://github.com/aspnet/Razor.git","svn_url":"https://github.com/aspnet/Razor","homepage":"","size":7222,"stargazers_count":519,"watchers_count":519,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":149,"mirror_url":null,"open_issues_count":98,"forks":149,"open_issues":98,"watchers":519,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/aspnet/Razor/pulls/765"},"html":{"href":"https://github.com/aspnet/Razor/pull/765"},"issue":{"href":"https://api.github.com/repos/aspnet/Razor/issues/765"},"comments":{"href":"https://api.github.com/repos/aspnet/Razor/issues/765/comments"},"review_comments":{"href":"https://api.github.com/repos/aspnet/Razor/pulls/765/comments"},"review_comment":{"href":"https://api.github.com/repos/aspnet/Razor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aspnet/Razor/pulls/765/commits"},"statuses":{"href":"https://api.github.com/repos/aspnet/Razor/statuses/89bd7a6bc481f8187a44788f31da9ef250ab970e"}}}}
{"actor":{"display_login":"NTaylorMullen"}}