{"action":"created","comment":{"url":"https://api.github.com/repos/NancyFx/Nancy/pulls/comments/56278171","id":56278171,"diff_hunk":"@@ -83,7 +83,7 @@ public class NancyEngine : INancyEngine\n \r\n             this.dispatcher = dispatcher;\r\n             this.contextFactory = contextFactory;\r\n-            this.statusCodeHandlers = statusCodeHandlers;\r\n+            this.statusCodeHandlers = statusCodeHandlers.ToArray();\r","path":"src/Nancy/NancyEngine.cs","position":14,"original_position":14,"commit_id":"449ba67dc28514f067212729158b978d5116ad25","original_commit_id":"449ba67dc28514f067212729158b978d5116ad25","user":{"login":"phillip-haydon","id":895629,"avatar_url":"https://avatars.githubusercontent.com/u/895629?v=3","gravatar_id":"","url":"https://api.github.com/users/phillip-haydon","html_url":"https://github.com/phillip-haydon","followers_url":"https://api.github.com/users/phillip-haydon/followers","following_url":"https://api.github.com/users/phillip-haydon/following{/other_user}","gists_url":"https://api.github.com/users/phillip-haydon/gists{/gist_id}","starred_url":"https://api.github.com/users/phillip-haydon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phillip-haydon/subscriptions","organizations_url":"https://api.github.com/users/phillip-haydon/orgs","repos_url":"https://api.github.com/users/phillip-haydon/repos","events_url":"https://api.github.com/users/phillip-haydon/events{/privacy}","received_events_url":"https://api.github.com/users/phillip-haydon/received_events","type":"User","site_admin":false},"body":"Calling `ToArray()` will copy the list passed in, can't we just make the argument array to begin with and avoid the copy?","created_at":"2016-03-16T03:36:28Z","updated_at":"2016-03-16T03:36:28Z","html_url":"https://github.com/NancyFx/Nancy/pull/2363#discussion_r56278171","pull_request_url":"https://api.github.com/repos/NancyFx/Nancy/pulls/2363","_links":{"self":{"href":"https://api.github.com/repos/NancyFx/Nancy/pulls/comments/56278171"},"html":{"href":"https://github.com/NancyFx/Nancy/pull/2363#discussion_r56278171"},"pull_request":{"href":"https://api.github.com/repos/NancyFx/Nancy/pulls/2363"}}},"pull_request":{"url":"https://api.github.com/repos/NancyFx/Nancy/pulls/2363","id":62900130,"html_url":"https://github.com/NancyFx/Nancy/pull/2363","diff_url":"https://github.com/NancyFx/Nancy/pull/2363.diff","patch_url":"https://github.com/NancyFx/Nancy/pull/2363.patch","issue_url":"https://api.github.com/repos/NancyFx/Nancy/issues/2363","number":2363,"state":"open","locked":false,"title":"Optimization of CheckStatusCodeHandler in NancyEngine","user":{"login":"thecodejunkie","id":50543,"avatar_url":"https://avatars.githubusercontent.com/u/50543?v=3","gravatar_id":"","url":"https://api.github.com/users/thecodejunkie","html_url":"https://github.com/thecodejunkie","followers_url":"https://api.github.com/users/thecodejunkie/followers","following_url":"https://api.github.com/users/thecodejunkie/following{/other_user}","gists_url":"https://api.github.com/users/thecodejunkie/gists{/gist_id}","starred_url":"https://api.github.com/users/thecodejunkie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thecodejunkie/subscriptions","organizations_url":"https://api.github.com/users/thecodejunkie/orgs","repos_url":"https://api.github.com/users/thecodejunkie/repos","events_url":"https://api.github.com/users/thecodejunkie/events{/privacy}","received_events_url":"https://api.github.com/users/thecodejunkie/received_events","type":"User","site_admin":false},"body":"Minor tweak while chasing bigger dragons. The `CheckStatusCodeHandler` runs on every request to see if it should be taking any special action based on the returned status code. This is part of a 100k requests sample\r\n\r\n- Removed LINQ magic\r\n\r\nThis loops over the `IStatusCodeHandler` once and mimics of a `FirstOrDefault` by only assigning values if nothing has previously been written. If both the `default` and `custom` handlers has been assigned, then it will exist the loop early\r\n\r\nBefore\r\n![image](https://cloud.githubusercontent.com/assets/50543/13778216/cc5b57fe-eab4-11e5-8924-8a0a6a6b4c0a.png)\r\n\r\nAfter\r\n![image](https://cloud.githubusercontent.com/assets/50543/13778228/dd18c270-eab4-11e5-835a-d77250ec4044.png)\r\n","created_at":"2016-03-15T12:50:34Z","updated_at":"2016-03-16T03:36:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9965830a0f457cf27acaa5c6fd657185a4a4372e","assignee":null,"milestone":{"url":"https://api.github.com/repos/NancyFx/Nancy/milestones/38","html_url":"https://github.com/NancyFx/Nancy/milestones/2.0","labels_url":"https://api.github.com/repos/NancyFx/Nancy/milestones/38/labels","id":965127,"number":38,"title":"2.0","description":"Authentication update to use the (horrible) .net 4.5 style ClaimsPrincipal.","creator":{"login":"grumpydev","id":527013,"avatar_url":"https://avatars.githubusercontent.com/u/527013?v=3","gravatar_id":"","url":"https://api.github.com/users/grumpydev","html_url":"https://github.com/grumpydev","followers_url":"https://api.github.com/users/grumpydev/followers","following_url":"https://api.github.com/users/grumpydev/following{/other_user}","gists_url":"https://api.github.com/users/grumpydev/gists{/gist_id}","starred_url":"https://api.github.com/users/grumpydev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grumpydev/subscriptions","organizations_url":"https://api.github.com/users/grumpydev/orgs","repos_url":"https://api.github.com/users/grumpydev/repos","events_url":"https://api.github.com/users/grumpydev/events{/privacy}","received_events_url":"https://api.github.com/users/grumpydev/received_events","type":"User","site_admin":false},"open_issues":20,"closed_issues":130,"state":"open","created_at":"2015-02-04T09:08:48Z","updated_at":"2016-03-16T03:32:59Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/NancyFx/Nancy/pulls/2363/commits","review_comments_url":"https://api.github.com/repos/NancyFx/Nancy/pulls/2363/comments","review_comment_url":"https://api.github.com/repos/NancyFx/Nancy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NancyFx/Nancy/issues/2363/comments","statuses_url":"https://api.github.com/repos/NancyFx/Nancy/statuses/449ba67dc28514f067212729158b978d5116ad25","head":{"label":"thecodejunkie:benchmark-nancyengine-checkstatuscodehandler","ref":"benchmark-nancyengine-checkstatuscodehandler","sha":"449ba67dc28514f067212729158b978d5116ad25","user":{"login":"thecodejunkie","id":50543,"avatar_url":"https://avatars.githubusercontent.com/u/50543?v=3","gravatar_id":"","url":"https://api.github.com/users/thecodejunkie","html_url":"https://github.com/thecodejunkie","followers_url":"https://api.github.com/users/thecodejunkie/followers","following_url":"https://api.github.com/users/thecodejunkie/following{/other_user}","gists_url":"https://api.github.com/users/thecodejunkie/gists{/gist_id}","starred_url":"https://api.github.com/users/thecodejunkie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thecodejunkie/subscriptions","organizations_url":"https://api.github.com/users/thecodejunkie/orgs","repos_url":"https://api.github.com/users/thecodejunkie/repos","events_url":"https://api.github.com/users/thecodejunkie/events{/privacy}","received_events_url":"https://api.github.com/users/thecodejunkie/received_events","type":"User","site_admin":false},"repo":{"id":2011293,"name":"Nancy","full_name":"thecodejunkie/Nancy","owner":{"login":"thecodejunkie","id":50543,"avatar_url":"https://avatars.githubusercontent.com/u/50543?v=3","gravatar_id":"","url":"https://api.github.com/users/thecodejunkie","html_url":"https://github.com/thecodejunkie","followers_url":"https://api.github.com/users/thecodejunkie/followers","following_url":"https://api.github.com/users/thecodejunkie/following{/other_user}","gists_url":"https://api.github.com/users/thecodejunkie/gists{/gist_id}","starred_url":"https://api.github.com/users/thecodejunkie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thecodejunkie/subscriptions","organizations_url":"https://api.github.com/users/thecodejunkie/orgs","repos_url":"https://api.github.com/users/thecodejunkie/repos","events_url":"https://api.github.com/users/thecodejunkie/events{/privacy}","received_events_url":"https://api.github.com/users/thecodejunkie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thecodejunkie/Nancy","description":"A Sinatra inspired web framework for the .NET platform. THIS IS NOT THE AUTHORITATIVE REPO. PLEASE SEND PULL REQUESTS TO http://github.com/NancyFx/Nancy","fork":true,"url":"https://api.github.com/repos/thecodejunkie/Nancy","forks_url":"https://api.github.com/repos/thecodejunkie/Nancy/forks","keys_url":"https://api.github.com/repos/thecodejunkie/Nancy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thecodejunkie/Nancy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thecodejunkie/Nancy/teams","hooks_url":"https://api.github.com/repos/thecodejunkie/Nancy/hooks","issue_events_url":"https://api.github.com/repos/thecodejunkie/Nancy/issues/events{/number}","events_url":"https://api.github.com/repos/thecodejunkie/Nancy/events","assignees_url":"https://api.github.com/repos/thecodejunkie/Nancy/assignees{/user}","branches_url":"https://api.github.com/repos/thecodejunkie/Nancy/branches{/branch}","tags_url":"https://api.github.com/repos/thecodejunkie/Nancy/tags","blobs_url":"https://api.github.com/repos/thecodejunkie/Nancy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thecodejunkie/Nancy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thecodejunkie/Nancy/git/refs{/sha}","trees_url":"https://api.github.com/repos/thecodejunkie/Nancy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thecodejunkie/Nancy/statuses/{sha}","languages_url":"https://api.github.com/repos/thecodejunkie/Nancy/languages","stargazers_url":"https://api.github.com/repos/thecodejunkie/Nancy/stargazers","contributors_url":"https://api.github.com/repos/thecodejunkie/Nancy/contributors","subscribers_url":"https://api.github.com/repos/thecodejunkie/Nancy/subscribers","subscription_url":"https://api.github.com/repos/thecodejunkie/Nancy/subscription","commits_url":"https://api.github.com/repos/thecodejunkie/Nancy/commits{/sha}","git_commits_url":"https://api.github.com/repos/thecodejunkie/Nancy/git/commits{/sha}","comments_url":"https://api.github.com/repos/thecodejunkie/Nancy/comments{/number}","issue_comment_url":"https://api.github.com/repos/thecodejunkie/Nancy/issues/comments{/number}","contents_url":"https://api.github.com/repos/thecodejunkie/Nancy/contents/{+path}","compare_url":"https://api.github.com/repos/thecodejunkie/Nancy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thecodejunkie/Nancy/merges","archive_url":"https://api.github.com/repos/thecodejunkie/Nancy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thecodejunkie/Nancy/downloads","issues_url":"https://api.github.com/repos/thecodejunkie/Nancy/issues{/number}","pulls_url":"https://api.github.com/repos/thecodejunkie/Nancy/pulls{/number}","milestones_url":"https://api.github.com/repos/thecodejunkie/Nancy/milestones{/number}","notifications_url":"https://api.github.com/repos/thecodejunkie/Nancy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thecodejunkie/Nancy/labels{/name}","releases_url":"https://api.github.com/repos/thecodejunkie/Nancy/releases{/id}","deployments_url":"https://api.github.com/repos/thecodejunkie/Nancy/deployments","created_at":"2011-07-07T09:02:38Z","updated_at":"2016-03-09T16:40:29Z","pushed_at":"2016-03-15T22:07:49Z","git_url":"git://github.com/thecodejunkie/Nancy.git","ssh_url":"git@github.com:thecodejunkie/Nancy.git","clone_url":"https://github.com/thecodejunkie/Nancy.git","svn_url":"https://github.com/thecodejunkie/Nancy","homepage":"","size":51648,"stargazers_count":48,"watchers_count":48,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":0,"forks":13,"open_issues":0,"watchers":48,"default_branch":"master"}},"base":{"label":"NancyFx:master","ref":"master","sha":"01af42fe60a1c2c006fafc2c03dfe639a219afcf","user":{"login":"NancyFx","id":706659,"avatar_url":"https://avatars.githubusercontent.com/u/706659?v=3","gravatar_id":"","url":"https://api.github.com/users/NancyFx","html_url":"https://github.com/NancyFx","followers_url":"https://api.github.com/users/NancyFx/followers","following_url":"https://api.github.com/users/NancyFx/following{/other_user}","gists_url":"https://api.github.com/users/NancyFx/gists{/gist_id}","starred_url":"https://api.github.com/users/NancyFx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NancyFx/subscriptions","organizations_url":"https://api.github.com/users/NancyFx/orgs","repos_url":"https://api.github.com/users/NancyFx/repos","events_url":"https://api.github.com/users/NancyFx/events{/privacy}","received_events_url":"https://api.github.com/users/NancyFx/received_events","type":"Organization","site_admin":false},"repo":{"id":738250,"name":"Nancy","full_name":"NancyFx/Nancy","owner":{"login":"NancyFx","id":706659,"avatar_url":"https://avatars.githubusercontent.com/u/706659?v=3","gravatar_id":"","url":"https://api.github.com/users/NancyFx","html_url":"https://github.com/NancyFx","followers_url":"https://api.github.com/users/NancyFx/followers","following_url":"https://api.github.com/users/NancyFx/following{/other_user}","gists_url":"https://api.github.com/users/NancyFx/gists{/gist_id}","starred_url":"https://api.github.com/users/NancyFx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NancyFx/subscriptions","organizations_url":"https://api.github.com/users/NancyFx/orgs","repos_url":"https://api.github.com/users/NancyFx/repos","events_url":"https://api.github.com/users/NancyFx/events{/privacy}","received_events_url":"https://api.github.com/users/NancyFx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NancyFx/Nancy","description":"Lightweight, low-ceremony, framework for building HTTP based services on .Net and Mono","fork":false,"url":"https://api.github.com/repos/NancyFx/Nancy","forks_url":"https://api.github.com/repos/NancyFx/Nancy/forks","keys_url":"https://api.github.com/repos/NancyFx/Nancy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NancyFx/Nancy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NancyFx/Nancy/teams","hooks_url":"https://api.github.com/repos/NancyFx/Nancy/hooks","issue_events_url":"https://api.github.com/repos/NancyFx/Nancy/issues/events{/number}","events_url":"https://api.github.com/repos/NancyFx/Nancy/events","assignees_url":"https://api.github.com/repos/NancyFx/Nancy/assignees{/user}","branches_url":"https://api.github.com/repos/NancyFx/Nancy/branches{/branch}","tags_url":"https://api.github.com/repos/NancyFx/Nancy/tags","blobs_url":"https://api.github.com/repos/NancyFx/Nancy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NancyFx/Nancy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NancyFx/Nancy/git/refs{/sha}","trees_url":"https://api.github.com/repos/NancyFx/Nancy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NancyFx/Nancy/statuses/{sha}","languages_url":"https://api.github.com/repos/NancyFx/Nancy/languages","stargazers_url":"https://api.github.com/repos/NancyFx/Nancy/stargazers","contributors_url":"https://api.github.com/repos/NancyFx/Nancy/contributors","subscribers_url":"https://api.github.com/repos/NancyFx/Nancy/subscribers","subscription_url":"https://api.github.com/repos/NancyFx/Nancy/subscription","commits_url":"https://api.github.com/repos/NancyFx/Nancy/commits{/sha}","git_commits_url":"https://api.github.com/repos/NancyFx/Nancy/git/commits{/sha}","comments_url":"https://api.github.com/repos/NancyFx/Nancy/comments{/number}","issue_comment_url":"https://api.github.com/repos/NancyFx/Nancy/issues/comments{/number}","contents_url":"https://api.github.com/repos/NancyFx/Nancy/contents/{+path}","compare_url":"https://api.github.com/repos/NancyFx/Nancy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NancyFx/Nancy/merges","archive_url":"https://api.github.com/repos/NancyFx/Nancy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NancyFx/Nancy/downloads","issues_url":"https://api.github.com/repos/NancyFx/Nancy/issues{/number}","pulls_url":"https://api.github.com/repos/NancyFx/Nancy/pulls{/number}","milestones_url":"https://api.github.com/repos/NancyFx/Nancy/milestones{/number}","notifications_url":"https://api.github.com/repos/NancyFx/Nancy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NancyFx/Nancy/labels{/name}","releases_url":"https://api.github.com/repos/NancyFx/Nancy/releases{/id}","deployments_url":"https://api.github.com/repos/NancyFx/Nancy/deployments","created_at":"2010-06-24T19:35:22Z","updated_at":"2016-03-15T18:30:53Z","pushed_at":"2016-03-16T03:33:00Z","git_url":"git://github.com/NancyFx/Nancy.git","ssh_url":"git@github.com:NancyFx/Nancy.git","clone_url":"https://github.com/NancyFx/Nancy.git","svn_url":"https://github.com/NancyFx/Nancy","homepage":"http://nancyfx.org","size":62999,"stargazers_count":3847,"watchers_count":3847,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1002,"mirror_url":null,"open_issues_count":130,"forks":1002,"open_issues":130,"watchers":3847,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NancyFx/Nancy/pulls/2363"},"html":{"href":"https://github.com/NancyFx/Nancy/pull/2363"},"issue":{"href":"https://api.github.com/repos/NancyFx/Nancy/issues/2363"},"comments":{"href":"https://api.github.com/repos/NancyFx/Nancy/issues/2363/comments"},"review_comments":{"href":"https://api.github.com/repos/NancyFx/Nancy/pulls/2363/comments"},"review_comment":{"href":"https://api.github.com/repos/NancyFx/Nancy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NancyFx/Nancy/pulls/2363/commits"},"statuses":{"href":"https://api.github.com/repos/NancyFx/Nancy/statuses/449ba67dc28514f067212729158b978d5116ad25"}}}}