{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/bond/pulls/comments/44106736","id":44106736,"diff_hunk":"@@ -0,0 +1,127 @@\n+﻿using System;\n+using System.Collections.Generic;\n+using System.Linq;\n+using System.Runtime.CompilerServices;\n+using System.Runtime.ConstrainedExecution;\n+using System.Runtime.InteropServices;\n+using System.Security;\n+using System.Text;\n+using System.Threading.Tasks;\n+\n+namespace Bond.IO.Unsafe\n+{\n+    internal unsafe class MemoryHelper\n+    {\n+        [DllImport(\"msvcrt.dll\", EntryPoint = \"memcpy\", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, SetLastError = false)]","path":"cs/src/io/unsafe/MemoryHelper.cs","position":15,"original_position":15,"commit_id":"aefa61a736f3f2efb86036a10b758a61c62ba843","original_commit_id":"aefa61a736f3f2efb86036a10b758a61c62ba843","user":{"login":"sapek","id":449129,"avatar_url":"https://avatars.githubusercontent.com/u/449129?v=3","gravatar_id":"","url":"https://api.github.com/users/sapek","html_url":"https://github.com/sapek","followers_url":"https://api.github.com/users/sapek/followers","following_url":"https://api.github.com/users/sapek/following{/other_user}","gists_url":"https://api.github.com/users/sapek/gists{/gist_id}","starred_url":"https://api.github.com/users/sapek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sapek/subscriptions","organizations_url":"https://api.github.com/users/sapek/orgs","repos_url":"https://api.github.com/users/sapek/repos","events_url":"https://api.github.com/users/sapek/events{/privacy}","received_events_url":"https://api.github.com/users/sapek/received_events","type":"User","site_admin":false},"body":"Another option that was suggested is to use `Marshal.Copy` since what we really need here is copy from unmanaged memory into `byte[]`. \r\n\r\nAlso for completeness: I have learned that Mono does have a DllMap feature allowing to remap `DllImport` via configuration. This would actually make it possible to import `memcpy` from different libraries on different platforms. But that is a rather unwieldy thing to maintain so I don't think we should do it here.","created_at":"2015-11-06T05:58:22Z","updated_at":"2015-11-06T05:58:22Z","html_url":"https://github.com/Microsoft/bond/pull/93#discussion_r44106736","pull_request_url":"https://api.github.com/repos/Microsoft/bond/pulls/93","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/bond/pulls/comments/44106736"},"html":{"href":"https://github.com/Microsoft/bond/pull/93#discussion_r44106736"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/bond/pulls/93"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/bond/pulls/93","id":49709334,"html_url":"https://github.com/Microsoft/bond/pull/93","diff_url":"https://github.com/Microsoft/bond/pull/93.diff","patch_url":"https://github.com/Microsoft/bond/pull/93.patch","issue_url":"https://api.github.com/repos/Microsoft/bond/issues/93","number":93,"state":"open","locked":false,"title":"Support for unsafe pointer based InputBuffer and OutputBuffer","user":{"login":"redknightlois","id":1045411,"avatar_url":"https://avatars.githubusercontent.com/u/1045411?v=3","gravatar_id":"","url":"https://api.github.com/users/redknightlois","html_url":"https://github.com/redknightlois","followers_url":"https://api.github.com/users/redknightlois/followers","following_url":"https://api.github.com/users/redknightlois/following{/other_user}","gists_url":"https://api.github.com/users/redknightlois/gists{/gist_id}","starred_url":"https://api.github.com/users/redknightlois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redknightlois/subscriptions","organizations_url":"https://api.github.com/users/redknightlois/orgs","repos_url":"https://api.github.com/users/redknightlois/repos","events_url":"https://api.github.com/users/redknightlois/events{/privacy}","received_events_url":"https://api.github.com/users/redknightlois/received_events","type":"User","site_admin":false},"body":"The InputPtrBuffer and OutputPtrBuffer will not have the ability to grow because they do not have ownership of the memory involved.\r\n\r\nAdded an optimized memory copy implementation that it's even faster than BlockCopy, System.Buffer (.Net 4.6) and looping for small values. That’s 4,8 Gb/sec against 3,6 Gb/sec (fastest in System.Buffer) in Bulk Copy mode in the tested environment.\r\nhttps://gist.github.com/redknightlois/149fdd3479cbd074f115\r\n\r\nI haven't implemented an optimized ReadBytes(). That would require some internal changes that I don't think I can do on my own without further discussion. \r\n\r\nFixes #92","created_at":"2015-11-04T16:17:08Z","updated_at":"2015-11-06T05:58:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"46c2634628a98a5990506a88f5bf26a37b49a54d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/bond/pulls/93/commits","review_comments_url":"https://api.github.com/repos/Microsoft/bond/pulls/93/comments","review_comment_url":"https://api.github.com/repos/Microsoft/bond/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/bond/issues/93/comments","statuses_url":"https://api.github.com/repos/Microsoft/bond/statuses/aefa61a736f3f2efb86036a10b758a61c62ba843","head":{"label":"redknightlois:master","ref":"master","sha":"aefa61a736f3f2efb86036a10b758a61c62ba843","user":{"login":"redknightlois","id":1045411,"avatar_url":"https://avatars.githubusercontent.com/u/1045411?v=3","gravatar_id":"","url":"https://api.github.com/users/redknightlois","html_url":"https://github.com/redknightlois","followers_url":"https://api.github.com/users/redknightlois/followers","following_url":"https://api.github.com/users/redknightlois/following{/other_user}","gists_url":"https://api.github.com/users/redknightlois/gists{/gist_id}","starred_url":"https://api.github.com/users/redknightlois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redknightlois/subscriptions","organizations_url":"https://api.github.com/users/redknightlois/orgs","repos_url":"https://api.github.com/users/redknightlois/repos","events_url":"https://api.github.com/users/redknightlois/events{/privacy}","received_events_url":"https://api.github.com/users/redknightlois/received_events","type":"User","site_admin":false},"repo":{"id":45550222,"name":"bond","full_name":"redknightlois/bond","owner":{"login":"redknightlois","id":1045411,"avatar_url":"https://avatars.githubusercontent.com/u/1045411?v=3","gravatar_id":"","url":"https://api.github.com/users/redknightlois","html_url":"https://github.com/redknightlois","followers_url":"https://api.github.com/users/redknightlois/followers","following_url":"https://api.github.com/users/redknightlois/following{/other_user}","gists_url":"https://api.github.com/users/redknightlois/gists{/gist_id}","starred_url":"https://api.github.com/users/redknightlois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redknightlois/subscriptions","organizations_url":"https://api.github.com/users/redknightlois/orgs","repos_url":"https://api.github.com/users/redknightlois/repos","events_url":"https://api.github.com/users/redknightlois/events{/privacy}","received_events_url":"https://api.github.com/users/redknightlois/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/redknightlois/bond","description":"Bond is a cross-platform framework for working with schematized data. It supports cross-language de/serialization and powerful generic mechanisms for efficiently manipulating data. Bond is broadly used at Microsoft in high scale services. ","fork":true,"url":"https://api.github.com/repos/redknightlois/bond","forks_url":"https://api.github.com/repos/redknightlois/bond/forks","keys_url":"https://api.github.com/repos/redknightlois/bond/keys{/key_id}","collaborators_url":"https://api.github.com/repos/redknightlois/bond/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/redknightlois/bond/teams","hooks_url":"https://api.github.com/repos/redknightlois/bond/hooks","issue_events_url":"https://api.github.com/repos/redknightlois/bond/issues/events{/number}","events_url":"https://api.github.com/repos/redknightlois/bond/events","assignees_url":"https://api.github.com/repos/redknightlois/bond/assignees{/user}","branches_url":"https://api.github.com/repos/redknightlois/bond/branches{/branch}","tags_url":"https://api.github.com/repos/redknightlois/bond/tags","blobs_url":"https://api.github.com/repos/redknightlois/bond/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/redknightlois/bond/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/redknightlois/bond/git/refs{/sha}","trees_url":"https://api.github.com/repos/redknightlois/bond/git/trees{/sha}","statuses_url":"https://api.github.com/repos/redknightlois/bond/statuses/{sha}","languages_url":"https://api.github.com/repos/redknightlois/bond/languages","stargazers_url":"https://api.github.com/repos/redknightlois/bond/stargazers","contributors_url":"https://api.github.com/repos/redknightlois/bond/contributors","subscribers_url":"https://api.github.com/repos/redknightlois/bond/subscribers","subscription_url":"https://api.github.com/repos/redknightlois/bond/subscription","commits_url":"https://api.github.com/repos/redknightlois/bond/commits{/sha}","git_commits_url":"https://api.github.com/repos/redknightlois/bond/git/commits{/sha}","comments_url":"https://api.github.com/repos/redknightlois/bond/comments{/number}","issue_comment_url":"https://api.github.com/repos/redknightlois/bond/issues/comments{/number}","contents_url":"https://api.github.com/repos/redknightlois/bond/contents/{+path}","compare_url":"https://api.github.com/repos/redknightlois/bond/compare/{base}...{head}","merges_url":"https://api.github.com/repos/redknightlois/bond/merges","archive_url":"https://api.github.com/repos/redknightlois/bond/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/redknightlois/bond/downloads","issues_url":"https://api.github.com/repos/redknightlois/bond/issues{/number}","pulls_url":"https://api.github.com/repos/redknightlois/bond/pulls{/number}","milestones_url":"https://api.github.com/repos/redknightlois/bond/milestones{/number}","notifications_url":"https://api.github.com/repos/redknightlois/bond/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/redknightlois/bond/labels{/name}","releases_url":"https://api.github.com/repos/redknightlois/bond/releases{/id}","created_at":"2015-11-04T16:02:15Z","updated_at":"2015-11-04T16:02:18Z","pushed_at":"2015-11-04T16:08:52Z","git_url":"git://github.com/redknightlois/bond.git","ssh_url":"git@github.com:redknightlois/bond.git","clone_url":"https://github.com/redknightlois/bond.git","svn_url":"https://github.com/redknightlois/bond","homepage":null,"size":4813,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"a4201850a6c120fdcfdf6bb91221626b9974eba2","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":28014525,"name":"bond","full_name":"Microsoft/bond","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/bond","description":"Bond is a cross-platform framework for working with schematized data. It supports cross-language de/serialization and powerful generic mechanisms for efficiently manipulating data. Bond is broadly used at Microsoft in high scale services. ","fork":false,"url":"https://api.github.com/repos/Microsoft/bond","forks_url":"https://api.github.com/repos/Microsoft/bond/forks","keys_url":"https://api.github.com/repos/Microsoft/bond/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/bond/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/bond/teams","hooks_url":"https://api.github.com/repos/Microsoft/bond/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/bond/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/bond/events","assignees_url":"https://api.github.com/repos/Microsoft/bond/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/bond/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/bond/tags","blobs_url":"https://api.github.com/repos/Microsoft/bond/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/bond/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/bond/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/bond/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/bond/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/bond/languages","stargazers_url":"https://api.github.com/repos/Microsoft/bond/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/bond/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/bond/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/bond/subscription","commits_url":"https://api.github.com/repos/Microsoft/bond/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/bond/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/bond/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/bond/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/bond/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/bond/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/bond/merges","archive_url":"https://api.github.com/repos/Microsoft/bond/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/bond/downloads","issues_url":"https://api.github.com/repos/Microsoft/bond/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/bond/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/bond/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/bond/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/bond/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/bond/releases{/id}","created_at":"2014-12-15T01:05:31Z","updated_at":"2015-11-05T03:15:45Z","pushed_at":"2015-11-06T00:01:59Z","git_url":"git://github.com/Microsoft/bond.git","ssh_url":"git@github.com:Microsoft/bond.git","clone_url":"https://github.com/Microsoft/bond.git","svn_url":"https://github.com/Microsoft/bond","homepage":null,"size":4813,"stargazers_count":1166,"watchers_count":1166,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":115,"mirror_url":null,"open_issues_count":22,"forks":115,"open_issues":22,"watchers":1166,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/bond/pulls/93"},"html":{"href":"https://github.com/Microsoft/bond/pull/93"},"issue":{"href":"https://api.github.com/repos/Microsoft/bond/issues/93"},"comments":{"href":"https://api.github.com/repos/Microsoft/bond/issues/93/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/bond/pulls/93/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/bond/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/bond/pulls/93/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/bond/statuses/aefa61a736f3f2efb86036a10b758a61c62ba843"}}}}