{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/corefx/issues/6281","repository_url":"https://api.github.com/repos/dotnet/corefx","labels_url":"https://api.github.com/repos/dotnet/corefx/issues/6281/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/6281/comments","events_url":"https://api.github.com/repos/dotnet/corefx/issues/6281/events","html_url":"https://github.com/dotnet/corefx/pull/6281","id":135158714,"number":6281,"title":"Rewrite WebUtility.HtmlEntities to minimize array/substring allocations","user":{"login":"jamesqo","id":9159214,"avatar_url":"https://avatars.githubusercontent.com/u/9159214?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesqo","html_url":"https://github.com/jamesqo","followers_url":"https://api.github.com/users/jamesqo/followers","following_url":"https://api.github.com/users/jamesqo/following{/other_user}","gists_url":"https://api.github.com/users/jamesqo/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesqo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesqo/subscriptions","organizations_url":"https://api.github.com/users/jamesqo/orgs","repos_url":"https://api.github.com/users/jamesqo/repos","events_url":"https://api.github.com/users/jamesqo/events{/privacy}","received_events_url":"https://api.github.com/users/jamesqo/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/corefx/labels/cla-already-signed","name":"cla-already-signed","color":"009800"},{"url":"https://api.github.com/repos/dotnet/corefx/labels/System.Net","name":"System.Net","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-21T04:37:01Z","updated_at":"2016-02-21T04:47:29Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/6281","html_url":"https://github.com/dotnet/corefx/pull/6281","diff_url":"https://github.com/dotnet/corefx/pull/6281.diff","patch_url":"https://github.com/dotnet/corefx/pull/6281.patch"},"body":"I was browsing the `WebUtility` source code recently and noticed there a huge static array allocation that was never actually used. In addition to that, all of the strings in the array were being `Substring`'d in a loop to initialize a dictionary, which added even more unnecessary allocations.\r\n\r\nI [rewrote](https://gist.github.com/jamesqo/dda32f6e7a4154053862) the code so it straight-up initializes the dictionary as a literal, using C# 6's new dictionary initializers feature. The new code also passes in a predefined capacity to the dictionary, so there's no resizing taking place when elements are added."},"comment":{"url":"https://api.github.com/repos/dotnet/corefx/issues/comments/186741844","html_url":"https://github.com/dotnet/corefx/pull/6281#issuecomment-186741844","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/6281","id":186741844,"user":{"login":"davidsh","id":7684835,"avatar_url":"https://avatars.githubusercontent.com/u/7684835?v=3","gravatar_id":"","url":"https://api.github.com/users/davidsh","html_url":"https://github.com/davidsh","followers_url":"https://api.github.com/users/davidsh/followers","following_url":"https://api.github.com/users/davidsh/following{/other_user}","gists_url":"https://api.github.com/users/davidsh/gists{/gist_id}","starred_url":"https://api.github.com/users/davidsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidsh/subscriptions","organizations_url":"https://api.github.com/users/davidsh/orgs","repos_url":"https://api.github.com/users/davidsh/repos","events_url":"https://api.github.com/users/davidsh/events{/privacy}","received_events_url":"https://api.github.com/users/davidsh/received_events","type":"User","site_admin":false},"created_at":"2016-02-21T04:47:29Z","updated_at":"2016-02-21T04:47:29Z","body":"@stephentoub PTAL"}}