{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/105794695","pull_request_review_id":26690771,"id":105794695,"diff_hunk":"@@ -612,7 +612,13 @@ internal static unsafe void ClearWithoutReferences(ref byte b, nuint byteLength)\n         {\n             if (byteLength == 0)\n                 return;\n-\n+            \n+#if AMD64\n+            if (byteLength > uint.MaxValue) goto PInvoke;","path":"src/mscorlib/src/System/Span.cs","position":7,"original_position":7,"commit_id":"531e9b5d5cd05017bc9f7e1a4766a91679baea37","original_commit_id":"531e9b5d5cd05017bc9f7e1a4766a91679baea37","user":{"login":"jkotas","id":6668460,"avatar_url":"https://avatars1.githubusercontent.com/u/6668460?v=3","gravatar_id":"","url":"https://api.github.com/users/jkotas","html_url":"https://github.com/jkotas","followers_url":"https://api.github.com/users/jkotas/followers","following_url":"https://api.github.com/users/jkotas/following{/other_user}","gists_url":"https://api.github.com/users/jkotas/gists{/gist_id}","starred_url":"https://api.github.com/users/jkotas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkotas/subscriptions","organizations_url":"https://api.github.com/users/jkotas/orgs","repos_url":"https://api.github.com/users/jkotas/repos","events_url":"https://api.github.com/users/jkotas/events{/privacy}","received_events_url":"https://api.github.com/users/jkotas/received_events","type":"User","site_admin":false},"body":"Sounds good to me.","created_at":"2017-03-13T23:11:49Z","updated_at":"2017-03-13T23:11:49Z","html_url":"https://github.com/dotnet/coreclr/pull/10110#discussion_r105794695","pull_request_url":"https://api.github.com/repos/dotnet/coreclr/pulls/10110","_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/105794695"},"html":{"href":"https://github.com/dotnet/coreclr/pull/10110#discussion_r105794695"},"pull_request":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/10110"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/10110","id":110238175,"html_url":"https://github.com/dotnet/coreclr/pull/10110","diff_url":"https://github.com/dotnet/coreclr/pull/10110.diff","patch_url":"https://github.com/dotnet/coreclr/pull/10110.patch","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/10110","number":10110,"state":"open","locked":false,"title":"Optimize Span.Clear() on AMD64","user":{"login":"helloguo","id":18431130,"avatar_url":"https://avatars2.githubusercontent.com/u/18431130?v=3","gravatar_id":"","url":"https://api.github.com/users/helloguo","html_url":"https://github.com/helloguo","followers_url":"https://api.github.com/users/helloguo/followers","following_url":"https://api.github.com/users/helloguo/following{/other_user}","gists_url":"https://api.github.com/users/helloguo/gists{/gist_id}","starred_url":"https://api.github.com/users/helloguo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helloguo/subscriptions","organizations_url":"https://api.github.com/users/helloguo/orgs","repos_url":"https://api.github.com/users/helloguo/repos","events_url":"https://api.github.com/users/helloguo/events{/privacy}","received_events_url":"https://api.github.com/users/helloguo/received_events","type":"User","site_admin":false},"body":"This PR optimizes `Span.Clear()` on AMD64 by using `initblk `IL to call `JIT_MemSet`. Before 512 bytes, the baseline uses C# manged implementation. And after 512 Byte, it eventually calls CRT `memset`, which uses `rep stosb` for this copy bucket. The prototype calls `JIT_MemSet`, which has better implementation for short length up to 512 bytes and same `rep stosb` after 512 bytes. Performance measurements were made on a Skylake Desktop - Intel(R) Core(TM)i7-6700K CPU @ 4.00 GHz 32 GB RAM with Windows 10 Enterprise. \r\n\r\nOne micro benchmark as shown below is used to test performance gain. The performance gain (from 22% to 58%) is shown in below table.\r\n\r\n            begin = DateTime.Now.Ticks;\r\n            for (uint i = 0; i < ITERATION; i++)\r\n            {\r\n                byteSpan.Clear();\r\n            }\r\n            time = DateTime.Now.Ticks - begin;\r\n\r\n![image](https://cloud.githubusercontent.com/assets/18431130/23818241/3d5798cc-05ae-11e7-9e4c-79e6ddd208dc.png)\r\n\r\n\r\n\r\nFix https://github.com/dotnet/coreclr/issues/9698","created_at":"2017-03-11T01:03:30Z","updated_at":"2017-03-13T23:11:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e2ff2354691eabd547b3fbd119c48c85caefed97","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/coreclr/pulls/10110/commits","review_comments_url":"https://api.github.com/repos/dotnet/coreclr/pulls/10110/comments","review_comment_url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/10110/comments","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/531e9b5d5cd05017bc9f7e1a4766a91679baea37","head":{"label":"helloguo:span","ref":"span","sha":"531e9b5d5cd05017bc9f7e1a4766a91679baea37","user":{"login":"helloguo","id":18431130,"avatar_url":"https://avatars2.githubusercontent.com/u/18431130?v=3","gravatar_id":"","url":"https://api.github.com/users/helloguo","html_url":"https://github.com/helloguo","followers_url":"https://api.github.com/users/helloguo/followers","following_url":"https://api.github.com/users/helloguo/following{/other_user}","gists_url":"https://api.github.com/users/helloguo/gists{/gist_id}","starred_url":"https://api.github.com/users/helloguo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helloguo/subscriptions","organizations_url":"https://api.github.com/users/helloguo/orgs","repos_url":"https://api.github.com/users/helloguo/repos","events_url":"https://api.github.com/users/helloguo/events{/privacy}","received_events_url":"https://api.github.com/users/helloguo/received_events","type":"User","site_admin":false},"repo":{"id":83717749,"name":"coreclr","full_name":"helloguo/coreclr","owner":{"login":"helloguo","id":18431130,"avatar_url":"https://avatars2.githubusercontent.com/u/18431130?v=3","gravatar_id":"","url":"https://api.github.com/users/helloguo","html_url":"https://github.com/helloguo","followers_url":"https://api.github.com/users/helloguo/followers","following_url":"https://api.github.com/users/helloguo/following{/other_user}","gists_url":"https://api.github.com/users/helloguo/gists{/gist_id}","starred_url":"https://api.github.com/users/helloguo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helloguo/subscriptions","organizations_url":"https://api.github.com/users/helloguo/orgs","repos_url":"https://api.github.com/users/helloguo/repos","events_url":"https://api.github.com/users/helloguo/events{/privacy}","received_events_url":"https://api.github.com/users/helloguo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/helloguo/coreclr","description":"This repo contains the .NET Core runtime, called CoreCLR, and the base library, called mscorlib. It includes the garbage collector, JIT compiler, base .NET data types and many low-level classes.","fork":true,"url":"https://api.github.com/repos/helloguo/coreclr","forks_url":"https://api.github.com/repos/helloguo/coreclr/forks","keys_url":"https://api.github.com/repos/helloguo/coreclr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/helloguo/coreclr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/helloguo/coreclr/teams","hooks_url":"https://api.github.com/repos/helloguo/coreclr/hooks","issue_events_url":"https://api.github.com/repos/helloguo/coreclr/issues/events{/number}","events_url":"https://api.github.com/repos/helloguo/coreclr/events","assignees_url":"https://api.github.com/repos/helloguo/coreclr/assignees{/user}","branches_url":"https://api.github.com/repos/helloguo/coreclr/branches{/branch}","tags_url":"https://api.github.com/repos/helloguo/coreclr/tags","blobs_url":"https://api.github.com/repos/helloguo/coreclr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/helloguo/coreclr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/helloguo/coreclr/git/refs{/sha}","trees_url":"https://api.github.com/repos/helloguo/coreclr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/helloguo/coreclr/statuses/{sha}","languages_url":"https://api.github.com/repos/helloguo/coreclr/languages","stargazers_url":"https://api.github.com/repos/helloguo/coreclr/stargazers","contributors_url":"https://api.github.com/repos/helloguo/coreclr/contributors","subscribers_url":"https://api.github.com/repos/helloguo/coreclr/subscribers","subscription_url":"https://api.github.com/repos/helloguo/coreclr/subscription","commits_url":"https://api.github.com/repos/helloguo/coreclr/commits{/sha}","git_commits_url":"https://api.github.com/repos/helloguo/coreclr/git/commits{/sha}","comments_url":"https://api.github.com/repos/helloguo/coreclr/comments{/number}","issue_comment_url":"https://api.github.com/repos/helloguo/coreclr/issues/comments{/number}","contents_url":"https://api.github.com/repos/helloguo/coreclr/contents/{+path}","compare_url":"https://api.github.com/repos/helloguo/coreclr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/helloguo/coreclr/merges","archive_url":"https://api.github.com/repos/helloguo/coreclr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/helloguo/coreclr/downloads","issues_url":"https://api.github.com/repos/helloguo/coreclr/issues{/number}","pulls_url":"https://api.github.com/repos/helloguo/coreclr/pulls{/number}","milestones_url":"https://api.github.com/repos/helloguo/coreclr/milestones{/number}","notifications_url":"https://api.github.com/repos/helloguo/coreclr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/helloguo/coreclr/labels{/name}","releases_url":"https://api.github.com/repos/helloguo/coreclr/releases{/id}","deployments_url":"https://api.github.com/repos/helloguo/coreclr/deployments","created_at":"2017-03-02T19:44:04Z","updated_at":"2017-03-02T19:45:17Z","pushed_at":"2017-03-13T21:21:15Z","git_url":"git://github.com/helloguo/coreclr.git","ssh_url":"git@github.com:helloguo/coreclr.git","clone_url":"https://github.com/helloguo/coreclr.git","svn_url":"https://github.com/helloguo/coreclr","homepage":"https://docs.microsoft.com/dotnet/","size":141504,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"dotnet:master","ref":"master","sha":"705e9a47a85efaee5a482065fd9d3f6c822b0152","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars3.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":30092893,"name":"coreclr","full_name":"dotnet/coreclr","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars3.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/coreclr","description":"This repo contains the .NET Core runtime, called CoreCLR, and the base library, called mscorlib. It includes the garbage collector, JIT compiler, base .NET data types and many low-level classes.","fork":false,"url":"https://api.github.com/repos/dotnet/coreclr","forks_url":"https://api.github.com/repos/dotnet/coreclr/forks","keys_url":"https://api.github.com/repos/dotnet/coreclr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/coreclr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/coreclr/teams","hooks_url":"https://api.github.com/repos/dotnet/coreclr/hooks","issue_events_url":"https://api.github.com/repos/dotnet/coreclr/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/coreclr/events","assignees_url":"https://api.github.com/repos/dotnet/coreclr/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/coreclr/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/coreclr/tags","blobs_url":"https://api.github.com/repos/dotnet/coreclr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/coreclr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/coreclr/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/coreclr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/coreclr/languages","stargazers_url":"https://api.github.com/repos/dotnet/coreclr/stargazers","contributors_url":"https://api.github.com/repos/dotnet/coreclr/contributors","subscribers_url":"https://api.github.com/repos/dotnet/coreclr/subscribers","subscription_url":"https://api.github.com/repos/dotnet/coreclr/subscription","commits_url":"https://api.github.com/repos/dotnet/coreclr/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/coreclr/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/coreclr/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/coreclr/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/coreclr/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/coreclr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/coreclr/merges","archive_url":"https://api.github.com/repos/dotnet/coreclr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/coreclr/downloads","issues_url":"https://api.github.com/repos/dotnet/coreclr/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/coreclr/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/coreclr/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/coreclr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/coreclr/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/coreclr/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/coreclr/deployments","created_at":"2015-01-30T22:10:02Z","updated_at":"2017-03-13T22:35:03Z","pushed_at":"2017-03-13T22:44:50Z","git_url":"git://github.com/dotnet/coreclr.git","ssh_url":"git@github.com:dotnet/coreclr.git","clone_url":"https://github.com/dotnet/coreclr.git","svn_url":"https://github.com/dotnet/coreclr","homepage":"https://docs.microsoft.com/dotnet/","size":141854,"stargazers_count":7492,"watchers_count":7492,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1867,"mirror_url":null,"open_issues_count":1172,"forks":1867,"open_issues":1172,"watchers":7492,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/10110"},"html":{"href":"https://github.com/dotnet/coreclr/pull/10110"},"issue":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/10110"},"comments":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/10110/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/10110/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/10110/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/coreclr/statuses/531e9b5d5cd05017bc9f7e1a4766a91679baea37"}}}}
{"actor":{"display_login":"jkotas"}}