{"action":"created","comment":{"url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments/47865813","id":47865813,"diff_hunk":"@@ -451,22 +493,31 @@ func (v Value) GetTimeseries() (InternalTimeSeriesData, error) {\n \treturn ts, v.GetProto(&ts)\n }\n \n+var crc32Pool = sync.Pool{\n+\tNew: func() interface{} {\n+\t\treturn crc32.NewIEEE()\n+\t},\n+}\n+\n // computeChecksum computes a checksum based on the provided key and\n-// the contents of the value. If the value contains a byte slice, the\n-// checksum includes it directly.\n+// the contents of the value.\n func (v Value) computeChecksum(key []byte) uint32 {\n+\tif len(v.RawBytes) < headerSize {\n+\t\treturn 0\n+\t}\n \tcrc := crc32Pool.Get().(hash.Hash32)\n \tif _, err := crc.Write(key); err != nil {\n \t\tpanic(err)\n \t}\n-\tif v.RawBytes != nil {\n-\t\tif _, err := crc.Write(v.RawBytes); err != nil {\n-\t\t\tpanic(err)\n-\t\t}\n+\tif _, err := crc.Write(v.RawBytes[4:]); err != nil {\n+\t\tpanic(err)\n \t}\n \tsum := crc.Sum32()\n \tcrc.Reset()\n \tcrc32Pool.Put(crc)\n+\tif sum == 0 {","path":"roachpb/data.go","position":275,"original_position":275,"commit_id":"5cb73c940a500f66d807f7f72efd77cb32f8f04f","original_commit_id":"5cb73c940a500f66d807f7f72efd77cb32f8f04f","user":{"login":"tschottdorf","id":5076964,"avatar_url":"https://avatars.githubusercontent.com/u/5076964?v=3","gravatar_id":"","url":"https://api.github.com/users/tschottdorf","html_url":"https://github.com/tschottdorf","followers_url":"https://api.github.com/users/tschottdorf/followers","following_url":"https://api.github.com/users/tschottdorf/following{/other_user}","gists_url":"https://api.github.com/users/tschottdorf/gists{/gist_id}","starred_url":"https://api.github.com/users/tschottdorf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschottdorf/subscriptions","organizations_url":"https://api.github.com/users/tschottdorf/orgs","repos_url":"https://api.github.com/users/tschottdorf/repos","events_url":"https://api.github.com/users/tschottdorf/events{/privacy}","received_events_url":"https://api.github.com/users/tschottdorf/received_events","type":"User","site_admin":false},"body":"what's this?","created_at":"2015-12-17T03:29:56Z","updated_at":"2015-12-17T03:29:56Z","html_url":"https://github.com/cockroachdb/cockroach/pull/3477#discussion_r47865813","pull_request_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/3477","_links":{"self":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments/47865813"},"html":{"href":"https://github.com/cockroachdb/cockroach/pull/3477#discussion_r47865813"},"pull_request":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/3477"}}},"pull_request":{"url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/3477","id":53929481,"html_url":"https://github.com/cockroachdb/cockroach/pull/3477","diff_url":"https://github.com/cockroachdb/cockroach/pull/3477.diff","patch_url":"https://github.com/cockroachdb/cockroach/pull/3477.patch","issue_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/3477","number":3477,"state":"open","locked":false,"title":"Refactor roachpb.Value.","user":{"login":"petermattis","id":6201335,"avatar_url":"https://avatars.githubusercontent.com/u/6201335?v=3","gravatar_id":"","url":"https://api.github.com/users/petermattis","html_url":"https://github.com/petermattis","followers_url":"https://api.github.com/users/petermattis/followers","following_url":"https://api.github.com/users/petermattis/following{/other_user}","gists_url":"https://api.github.com/users/petermattis/gists{/gist_id}","starred_url":"https://api.github.com/users/petermattis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petermattis/subscriptions","organizations_url":"https://api.github.com/users/petermattis/orgs","repos_url":"https://api.github.com/users/petermattis/repos","events_url":"https://api.github.com/users/petermattis/events{/privacy}","received_events_url":"https://api.github.com/users/petermattis/received_events","type":"User","site_admin":false},"body":"Removed the Checksum and Tag fields from Value and encode them directly\r\ninto Value.RawBytes. Changed MVCC to store Value.RawBytes instead of an\r\nencoded Value and for MVCCMetadata to contain a RawBytes field instead of a\r\nValue for inline data. The custom encoding of checksum and tag avoid a\r\nsmall amount of encoding overhead and allows KV operations to avoid\r\ndecoding of the Value at the MVCC layer only to reencode when sending the\r\nresult over the network.\r\n\r\nMake Value.Timestamp non-nullable. This avoids an allocation in a core\r\ndata structure when read from disk and every time it is sent over the\r\nnetwork. This change was enabled by the storage of Value.RawBytes at the\r\nMVCC layer instead of Value (the non-nullable Value.Timestamp would\r\nalways be encoded which is undesirable when the timestamp is already\r\nencoded in the key) Together with the previous change there is a small\r\nimprovement to MVCCScan benchmarks.\r\n\r\n```\r\nname                                old time/op    new time/op    delta\r\nMVCCScan1Version1Row8Bytes-8          4.64µs ± 1%    4.28µs ± 1%   -7.69%  (p=0.000 n=8+10)\r\nMVCCScan1Version10Rows8Bytes-8        22.5µs ± 1%    20.6µs ± 0%   -8.35%   (p=0.000 n=10+8) \r\nMVCCScan1Version100Rows8Bytes-8       187µs ± 0%     172µs ± 0%    -8.21%  (p=0.000 n=10+10)\r\nMVCCScan1Version1000Rows8Bytes-8      1.82ms ± 0%    1.67ms ± 0%   -8.47% (p=0.000 n=10+10)\r\n```\n\n<!-- Reviewable:start -->\n[<img src=\"https://reviewable.io/review_button.png\" height=40 alt=\"Review on Reviewable\"/>](https://reviewable.io/reviews/cockroachdb/cockroach/3477)\n<!-- Reviewable:end -->\n","created_at":"2015-12-17T03:07:03Z","updated_at":"2015-12-17T03:29:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eb191206bdabf5372d285d6a928cfd2aa311a9f9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/3477/commits","review_comments_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/3477/comments","review_comment_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/3477/comments","statuses_url":"https://api.github.com/repos/cockroachdb/cockroach/statuses/5cb73c940a500f66d807f7f72efd77cb32f8f04f","head":{"label":"cockroachdb:pmattis/value-encoding","ref":"pmattis/value-encoding","sha":"5cb73c940a500f66d807f7f72efd77cb32f8f04f","user":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"repo":{"id":16563587,"name":"cockroach","full_name":"cockroachdb/cockroach","owner":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cockroachdb/cockroach","description":"A Scalable, Survivable, Strongly-Consistent SQL Database","fork":false,"url":"https://api.github.com/repos/cockroachdb/cockroach","forks_url":"https://api.github.com/repos/cockroachdb/cockroach/forks","keys_url":"https://api.github.com/repos/cockroachdb/cockroach/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cockroachdb/cockroach/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cockroachdb/cockroach/teams","hooks_url":"https://api.github.com/repos/cockroachdb/cockroach/hooks","issue_events_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/events{/number}","events_url":"https://api.github.com/repos/cockroachdb/cockroach/events","assignees_url":"https://api.github.com/repos/cockroachdb/cockroach/assignees{/user}","branches_url":"https://api.github.com/repos/cockroachdb/cockroach/branches{/branch}","tags_url":"https://api.github.com/repos/cockroachdb/cockroach/tags","blobs_url":"https://api.github.com/repos/cockroachdb/cockroach/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cockroachdb/cockroach/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cockroachdb/cockroach/git/refs{/sha}","trees_url":"https://api.github.com/repos/cockroachdb/cockroach/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cockroachdb/cockroach/statuses/{sha}","languages_url":"https://api.github.com/repos/cockroachdb/cockroach/languages","stargazers_url":"https://api.github.com/repos/cockroachdb/cockroach/stargazers","contributors_url":"https://api.github.com/repos/cockroachdb/cockroach/contributors","subscribers_url":"https://api.github.com/repos/cockroachdb/cockroach/subscribers","subscription_url":"https://api.github.com/repos/cockroachdb/cockroach/subscription","commits_url":"https://api.github.com/repos/cockroachdb/cockroach/commits{/sha}","git_commits_url":"https://api.github.com/repos/cockroachdb/cockroach/git/commits{/sha}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach/comments{/number}","issue_comment_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/comments{/number}","contents_url":"https://api.github.com/repos/cockroachdb/cockroach/contents/{+path}","compare_url":"https://api.github.com/repos/cockroachdb/cockroach/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cockroachdb/cockroach/merges","archive_url":"https://api.github.com/repos/cockroachdb/cockroach/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cockroachdb/cockroach/downloads","issues_url":"https://api.github.com/repos/cockroachdb/cockroach/issues{/number}","pulls_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls{/number}","milestones_url":"https://api.github.com/repos/cockroachdb/cockroach/milestones{/number}","notifications_url":"https://api.github.com/repos/cockroachdb/cockroach/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cockroachdb/cockroach/labels{/name}","releases_url":"https://api.github.com/repos/cockroachdb/cockroach/releases{/id}","created_at":"2014-02-06T00:18:47Z","updated_at":"2015-12-17T03:03:10Z","pushed_at":"2015-12-17T03:10:16Z","git_url":"git://github.com/cockroachdb/cockroach.git","ssh_url":"git@github.com:cockroachdb/cockroach.git","clone_url":"https://github.com/cockroachdb/cockroach.git","svn_url":"https://github.com/cockroachdb/cockroach","homepage":"http://www.cockroachlabs.com","size":56336,"stargazers_count":5867,"watchers_count":5867,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":504,"mirror_url":null,"open_issues_count":242,"forks":504,"open_issues":242,"watchers":5867,"default_branch":"master"}},"base":{"label":"cockroachdb:master","ref":"master","sha":"d825150a9f59dd86ef6678a52f224ee5cb52dec9","user":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"repo":{"id":16563587,"name":"cockroach","full_name":"cockroachdb/cockroach","owner":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cockroachdb/cockroach","description":"A Scalable, Survivable, Strongly-Consistent SQL Database","fork":false,"url":"https://api.github.com/repos/cockroachdb/cockroach","forks_url":"https://api.github.com/repos/cockroachdb/cockroach/forks","keys_url":"https://api.github.com/repos/cockroachdb/cockroach/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cockroachdb/cockroach/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cockroachdb/cockroach/teams","hooks_url":"https://api.github.com/repos/cockroachdb/cockroach/hooks","issue_events_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/events{/number}","events_url":"https://api.github.com/repos/cockroachdb/cockroach/events","assignees_url":"https://api.github.com/repos/cockroachdb/cockroach/assignees{/user}","branches_url":"https://api.github.com/repos/cockroachdb/cockroach/branches{/branch}","tags_url":"https://api.github.com/repos/cockroachdb/cockroach/tags","blobs_url":"https://api.github.com/repos/cockroachdb/cockroach/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cockroachdb/cockroach/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cockroachdb/cockroach/git/refs{/sha}","trees_url":"https://api.github.com/repos/cockroachdb/cockroach/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cockroachdb/cockroach/statuses/{sha}","languages_url":"https://api.github.com/repos/cockroachdb/cockroach/languages","stargazers_url":"https://api.github.com/repos/cockroachdb/cockroach/stargazers","contributors_url":"https://api.github.com/repos/cockroachdb/cockroach/contributors","subscribers_url":"https://api.github.com/repos/cockroachdb/cockroach/subscribers","subscription_url":"https://api.github.com/repos/cockroachdb/cockroach/subscription","commits_url":"https://api.github.com/repos/cockroachdb/cockroach/commits{/sha}","git_commits_url":"https://api.github.com/repos/cockroachdb/cockroach/git/commits{/sha}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach/comments{/number}","issue_comment_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/comments{/number}","contents_url":"https://api.github.com/repos/cockroachdb/cockroach/contents/{+path}","compare_url":"https://api.github.com/repos/cockroachdb/cockroach/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cockroachdb/cockroach/merges","archive_url":"https://api.github.com/repos/cockroachdb/cockroach/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cockroachdb/cockroach/downloads","issues_url":"https://api.github.com/repos/cockroachdb/cockroach/issues{/number}","pulls_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls{/number}","milestones_url":"https://api.github.com/repos/cockroachdb/cockroach/milestones{/number}","notifications_url":"https://api.github.com/repos/cockroachdb/cockroach/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cockroachdb/cockroach/labels{/name}","releases_url":"https://api.github.com/repos/cockroachdb/cockroach/releases{/id}","created_at":"2014-02-06T00:18:47Z","updated_at":"2015-12-17T03:03:10Z","pushed_at":"2015-12-17T03:10:16Z","git_url":"git://github.com/cockroachdb/cockroach.git","ssh_url":"git@github.com:cockroachdb/cockroach.git","clone_url":"https://github.com/cockroachdb/cockroach.git","svn_url":"https://github.com/cockroachdb/cockroach","homepage":"http://www.cockroachlabs.com","size":56336,"stargazers_count":5867,"watchers_count":5867,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":504,"mirror_url":null,"open_issues_count":242,"forks":504,"open_issues":242,"watchers":5867,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/3477"},"html":{"href":"https://github.com/cockroachdb/cockroach/pull/3477"},"issue":{"href":"https://api.github.com/repos/cockroachdb/cockroach/issues/3477"},"comments":{"href":"https://api.github.com/repos/cockroachdb/cockroach/issues/3477/comments"},"review_comments":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/3477/comments"},"review_comment":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/3477/commits"},"statuses":{"href":"https://api.github.com/repos/cockroachdb/cockroach/statuses/5cb73c940a500f66d807f7f72efd77cb32f8f04f"}}}}