{"action":"opened","number":1062,"pull_request":{"url":"https://api.github.com/repos/aspnet/HttpAbstractions/pulls/1062","id":229894253,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI5ODk0MjUz","html_url":"https://github.com/aspnet/HttpAbstractions/pull/1062","diff_url":"https://github.com/aspnet/HttpAbstractions/pull/1062.diff","patch_url":"https://github.com/aspnet/HttpAbstractions/pull/1062.patch","issue_url":"https://api.github.com/repos/aspnet/HttpAbstractions/issues/1062","number":1062,"state":"open","locked":false,"title":"Improve performance and reduce allocations in RouteValueDictionary.","user":{"login":"drieseng","id":312863,"node_id":"MDQ6VXNlcjMxMjg2Mw==","avatar_url":"https://avatars0.githubusercontent.com/u/312863?v=4","gravatar_id":"","url":"https://api.github.com/users/drieseng","html_url":"https://github.com/drieseng","followers_url":"https://api.github.com/users/drieseng/followers","following_url":"https://api.github.com/users/drieseng/following{/other_user}","gists_url":"https://api.github.com/users/drieseng/gists{/gist_id}","starred_url":"https://api.github.com/users/drieseng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drieseng/subscriptions","organizations_url":"https://api.github.com/users/drieseng/orgs","repos_url":"https://api.github.com/users/drieseng/repos","events_url":"https://api.github.com/users/drieseng/events{/privacy}","received_events_url":"https://api.github.com/users/drieseng/received_events","type":"User","site_admin":false},"body":"* Reduce allocations when **RouteValueDictionary** is initialized from another empty (array-based) **RouteValueDictionary**.\r\n* When **RouteValueDictionary** is initialized from another non-empty array-based **RouteValueDictionary**, then only allocate an array that corresponds with the number of items in that **RouteValueDictionary** instead of the capacity.\r\n* Refactor `ContainsKey(string key)` to use newly introduced `ContainsKeyArray(string key)` and `ContainsKeyProperties(string key)` methods that do not obtain the value of the key. This mostly affects the path where we're using property storage.\r\n* Update `Add(string key, object value)` and `TryAdd(string key, object value)` to use `ContainsKeyArray(string key)` to check whether an entry with the specified key already exists.\r\n* Improve performance of `TryAdd(string key, object value)` when backed by properties, and eliminate extra array allocation when number of properties is equal to capacity.\r\n\r\n**Benchmarks:**\r\n\r\n|                                          Method | Version    |      Mean |     Error |    StdDev |         Op/s |  Gen 0 | Allocated |\r\n|------------------------------------------------ |-----------:|----------:|----------:|----------:|-------------:|-------:|----------:|\r\n|                    ContainsKey_Properties_Found | master|  49.79 ns | 0.2453 ns | 0.1915 ns | 20,085,908.7 |      - |       0 B |\r\n|                    ContainsKey_Properties_Found |  \t\t PR|  39.03 ns | 1.7731 ns | 1.9708 ns | 25,623,247.9 |      - |       0 B |\r\n|                 ContainsKey_Properties_NotFound | master|  35.19 ns | 0.1114 ns | 0.0663 ns | 28,415,384.2 |      - |       0 B |\r\n|                 ContainsKey_Properties_NotFound |  \t\t PR|  31.73 ns | 0.0754 ns | 0.0589 ns | 31,514,773.8 |      - |       0 B |\r\n|          TryAdd_Properties_AtCapacity_KeyExists | master| 218.22 ns | 2.2617 ns | 2.1156 ns |  4,582,526.4 | 0.0024 |     208 B |\r\n|          TryAdd_Properties_AtCapacity_KeyExists |  \t\t PR| 150.07 ns | 1.8355 ns | 1.7169 ns |  6,663,347.2 | 0.0014 |     120 B |\r\n|    TryAdd_Properties_AtCapacity_KeyDoesNotExist | master| 151.90 ns | 1.2008 ns | 1.0645 ns |  6,583,092.7 | 0.0012 |     120 B |\r\n|    TryAdd_Properties_AtCapacity_KeyDoesNotExist |  \t\t PR| 144.29 ns | 2.0227 ns | 1.8920 ns |  6,930,577.9 | 0.0014 |     120 B |\r\n|       TryAdd_Properties_NotAtCapacity_KeyExists | master| 200.75 ns | 2.1600 ns | 2.0204 ns |  4,981,297.3 | 0.0021 |     200 B |\r\n|       TryAdd_Properties_NotAtCapacity_KeyExists |  \t\t PR| 145.98 ns | 2.4794 ns | 2.3192 ns |  6,850,315.0 | 0.0010 |     112 B |\r\n","created_at":"2018-11-10T15:11:05Z","updated_at":"2018-11-10T15:11:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/aspnet/HttpAbstractions/pulls/1062/commits","review_comments_url":"https://api.github.com/repos/aspnet/HttpAbstractions/pulls/1062/comments","review_comment_url":"https://api.github.com/repos/aspnet/HttpAbstractions/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aspnet/HttpAbstractions/issues/1062/comments","statuses_url":"https://api.github.com/repos/aspnet/HttpAbstractions/statuses/c9be018c7e2cce41157b37a17da7189d772635bc","head":{"label":"drieseng:master","ref":"master","sha":"c9be018c7e2cce41157b37a17da7189d772635bc","user":{"login":"drieseng","id":312863,"node_id":"MDQ6VXNlcjMxMjg2Mw==","avatar_url":"https://avatars0.githubusercontent.com/u/312863?v=4","gravatar_id":"","url":"https://api.github.com/users/drieseng","html_url":"https://github.com/drieseng","followers_url":"https://api.github.com/users/drieseng/followers","following_url":"https://api.github.com/users/drieseng/following{/other_user}","gists_url":"https://api.github.com/users/drieseng/gists{/gist_id}","starred_url":"https://api.github.com/users/drieseng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drieseng/subscriptions","organizations_url":"https://api.github.com/users/drieseng/orgs","repos_url":"https://api.github.com/users/drieseng/repos","events_url":"https://api.github.com/users/drieseng/events{/privacy}","received_events_url":"https://api.github.com/users/drieseng/received_events","type":"User","site_admin":false},"repo":{"id":156437536,"node_id":"MDEwOlJlcG9zaXRvcnkxNTY0Mzc1MzY=","name":"HttpAbstractions","full_name":"drieseng/HttpAbstractions","private":false,"owner":{"login":"drieseng","id":312863,"node_id":"MDQ6VXNlcjMxMjg2Mw==","avatar_url":"https://avatars0.githubusercontent.com/u/312863?v=4","gravatar_id":"","url":"https://api.github.com/users/drieseng","html_url":"https://github.com/drieseng","followers_url":"https://api.github.com/users/drieseng/followers","following_url":"https://api.github.com/users/drieseng/following{/other_user}","gists_url":"https://api.github.com/users/drieseng/gists{/gist_id}","starred_url":"https://api.github.com/users/drieseng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drieseng/subscriptions","organizations_url":"https://api.github.com/users/drieseng/orgs","repos_url":"https://api.github.com/users/drieseng/repos","events_url":"https://api.github.com/users/drieseng/events{/privacy}","received_events_url":"https://api.github.com/users/drieseng/received_events","type":"User","site_admin":false},"html_url":"https://github.com/drieseng/HttpAbstractions","description":"HTTP abstractions such as HttpRequest, HttpResponse, and HttpContext, as well as common web utilities.","fork":true,"url":"https://api.github.com/repos/drieseng/HttpAbstractions","forks_url":"https://api.github.com/repos/drieseng/HttpAbstractions/forks","keys_url":"https://api.github.com/repos/drieseng/HttpAbstractions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/drieseng/HttpAbstractions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/drieseng/HttpAbstractions/teams","hooks_url":"https://api.github.com/repos/drieseng/HttpAbstractions/hooks","issue_events_url":"https://api.github.com/repos/drieseng/HttpAbstractions/issues/events{/number}","events_url":"https://api.github.com/repos/drieseng/HttpAbstractions/events","assignees_url":"https://api.github.com/repos/drieseng/HttpAbstractions/assignees{/user}","branches_url":"https://api.github.com/repos/drieseng/HttpAbstractions/branches{/branch}","tags_url":"https://api.github.com/repos/drieseng/HttpAbstractions/tags","blobs_url":"https://api.github.com/repos/drieseng/HttpAbstractions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/drieseng/HttpAbstractions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/drieseng/HttpAbstractions/git/refs{/sha}","trees_url":"https://api.github.com/repos/drieseng/HttpAbstractions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/drieseng/HttpAbstractions/statuses/{sha}","languages_url":"https://api.github.com/repos/drieseng/HttpAbstractions/languages","stargazers_url":"https://api.github.com/repos/drieseng/HttpAbstractions/stargazers","contributors_url":"https://api.github.com/repos/drieseng/HttpAbstractions/contributors","subscribers_url":"https://api.github.com/repos/drieseng/HttpAbstractions/subscribers","subscription_url":"https://api.github.com/repos/drieseng/HttpAbstractions/subscription","commits_url":"https://api.github.com/repos/drieseng/HttpAbstractions/commits{/sha}","git_commits_url":"https://api.github.com/repos/drieseng/HttpAbstractions/git/commits{/sha}","comments_url":"https://api.github.com/repos/drieseng/HttpAbstractions/comments{/number}","issue_comment_url":"https://api.github.com/repos/drieseng/HttpAbstractions/issues/comments{/number}","contents_url":"https://api.github.com/repos/drieseng/HttpAbstractions/contents/{+path}","compare_url":"https://api.github.com/repos/drieseng/HttpAbstractions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/drieseng/HttpAbstractions/merges","archive_url":"https://api.github.com/repos/drieseng/HttpAbstractions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/drieseng/HttpAbstractions/downloads","issues_url":"https://api.github.com/repos/drieseng/HttpAbstractions/issues{/number}","pulls_url":"https://api.github.com/repos/drieseng/HttpAbstractions/pulls{/number}","milestones_url":"https://api.github.com/repos/drieseng/HttpAbstractions/milestones{/number}","notifications_url":"https://api.github.com/repos/drieseng/HttpAbstractions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/drieseng/HttpAbstractions/labels{/name}","releases_url":"https://api.github.com/repos/drieseng/HttpAbstractions/releases{/id}","deployments_url":"https://api.github.com/repos/drieseng/HttpAbstractions/deployments","created_at":"2018-11-06T19:38:33Z","updated_at":"2018-11-10T15:08:30Z","pushed_at":"2018-11-10T15:08:28Z","git_url":"git://github.com/drieseng/HttpAbstractions.git","ssh_url":"git@github.com:drieseng/HttpAbstractions.git","clone_url":"https://github.com/drieseng/HttpAbstractions.git","svn_url":"https://github.com/drieseng/HttpAbstractions","homepage":"","size":3398,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"aspnet:master","ref":"master","sha":"1d3521113ad69a9903d1590c77d67da04c5f5dfd","user":{"login":"aspnet","id":6476660,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY0NzY2NjA=","avatar_url":"https://avatars3.githubusercontent.com/u/6476660?v=4","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":15320915,"node_id":"MDEwOlJlcG9zaXRvcnkxNTMyMDkxNQ==","name":"HttpAbstractions","full_name":"aspnet/HttpAbstractions","private":false,"owner":{"login":"aspnet","id":6476660,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY0NzY2NjA=","avatar_url":"https://avatars3.githubusercontent.com/u/6476660?v=4","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},"html_url":"https://github.com/aspnet/HttpAbstractions","description":"HTTP abstractions such as HttpRequest, HttpResponse, and HttpContext, as well as common web utilities.","fork":false,"url":"https://api.github.com/repos/aspnet/HttpAbstractions","forks_url":"https://api.github.com/repos/aspnet/HttpAbstractions/forks","keys_url":"https://api.github.com/repos/aspnet/HttpAbstractions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/HttpAbstractions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/HttpAbstractions/teams","hooks_url":"https://api.github.com/repos/aspnet/HttpAbstractions/hooks","issue_events_url":"https://api.github.com/repos/aspnet/HttpAbstractions/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/HttpAbstractions/events","assignees_url":"https://api.github.com/repos/aspnet/HttpAbstractions/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/HttpAbstractions/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/HttpAbstractions/tags","blobs_url":"https://api.github.com/repos/aspnet/HttpAbstractions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/HttpAbstractions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/HttpAbstractions/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/HttpAbstractions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/HttpAbstractions/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/HttpAbstractions/languages","stargazers_url":"https://api.github.com/repos/aspnet/HttpAbstractions/stargazers","contributors_url":"https://api.github.com/repos/aspnet/HttpAbstractions/contributors","subscribers_url":"https://api.github.com/repos/aspnet/HttpAbstractions/subscribers","subscription_url":"https://api.github.com/repos/aspnet/HttpAbstractions/subscription","commits_url":"https://api.github.com/repos/aspnet/HttpAbstractions/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/HttpAbstractions/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/HttpAbstractions/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/HttpAbstractions/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/HttpAbstractions/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/HttpAbstractions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/HttpAbstractions/merges","archive_url":"https://api.github.com/repos/aspnet/HttpAbstractions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/HttpAbstractions/downloads","issues_url":"https://api.github.com/repos/aspnet/HttpAbstractions/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/HttpAbstractions/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/HttpAbstractions/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/HttpAbstractions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/HttpAbstractions/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/HttpAbstractions/releases{/id}","deployments_url":"https://api.github.com/repos/aspnet/HttpAbstractions/deployments","created_at":"2013-12-19T19:38:45Z","updated_at":"2018-11-08T02:52:04Z","pushed_at":"2018-11-10T01:28:26Z","git_url":"git://github.com/aspnet/HttpAbstractions.git","ssh_url":"git@github.com:aspnet/HttpAbstractions.git","clone_url":"https://github.com/aspnet/HttpAbstractions.git","svn_url":"https://github.com/aspnet/HttpAbstractions","homepage":"","size":3443,"stargazers_count":353,"watchers_count":353,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":193,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":193,"open_issues":4,"watchers":353,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/aspnet/HttpAbstractions/pulls/1062"},"html":{"href":"https://github.com/aspnet/HttpAbstractions/pull/1062"},"issue":{"href":"https://api.github.com/repos/aspnet/HttpAbstractions/issues/1062"},"comments":{"href":"https://api.github.com/repos/aspnet/HttpAbstractions/issues/1062/comments"},"review_comments":{"href":"https://api.github.com/repos/aspnet/HttpAbstractions/pulls/1062/comments"},"review_comment":{"href":"https://api.github.com/repos/aspnet/HttpAbstractions/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aspnet/HttpAbstractions/pulls/1062/commits"},"statuses":{"href":"https://api.github.com/repos/aspnet/HttpAbstractions/statuses/c9be018c7e2cce41157b37a17da7189d772635bc"}},"author_association":"NONE","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":336,"deletions":29,"changed_files":3}}
{"actor":{"display_login":"drieseng"}}