{"action":"created","comment":{"url":"https://api.github.com/repos/pingcap/tikv/pulls/comments/112176963","pull_request_review_id":33469898,"id":112176963,"diff_hunk":"@@ -0,0 +1,113 @@\n+// Copyright 2017 PingCAP, Inc.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//     http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+extern crate protobuf;\n+\n+use std::string::String;\n+use std::collections::HashMap;\n+use test::Bencher;\n+use rand;\n+use kvproto::eraftpb::Entry;\n+use kvproto::raft_cmdpb::{RaftCmdRequest, Request, CmdType};\n+\n+fn gen_rand_str(len: usize) -> Vec<u8> {\n+    let mut bstr = Vec::new();\n+    for _ in 0..len {\n+        bstr.push(rand::random::<u8>());\n+    }\n+    bstr\n+}\n+\n+fn generate_requests(map: &HashMap<&[u8], &[u8]>) -> Vec<Request> {\n+    let mut reqs = vec![];\n+    for (key, value) in map {\n+        let mut r = Request::new();\n+        r.set_cmd_type(CmdType::Put);\n+        r.mut_put().set_cf(String::from(\"tikv\"));\n+        r.mut_put().set_key(key.to_vec());\n+        r.mut_put().set_value(value.to_vec());\n+        reqs.push(r);\n+    }\n+    reqs\n+}\n+\n+fn encode(reqs: &[Request]) -> Vec<u8> {\n+    let mut e = Entry::new();\n+    let mut cmd = RaftCmdRequest::new();\n+    cmd.set_requests(protobuf::RepeatedField::from_vec(reqs.to_vec()));\n+    let cmd_msg = protobuf::Message::write_to_bytes(&cmd).unwrap();","path":"benches/serialization/bench_serialization.rs","position":48,"original_position":48,"commit_id":"bef6a816b26795896bca4d907983f360e934b9e1","original_commit_id":"bef6a816b26795896bca4d907983f360e934b9e1","user":{"login":"BusyJay","id":1701473,"avatar_url":"https://avatars0.githubusercontent.com/u/1701473?v=3","gravatar_id":"","url":"https://api.github.com/users/BusyJay","html_url":"https://github.com/BusyJay","followers_url":"https://api.github.com/users/BusyJay/followers","following_url":"https://api.github.com/users/BusyJay/following{/other_user}","gists_url":"https://api.github.com/users/BusyJay/gists{/gist_id}","starred_url":"https://api.github.com/users/BusyJay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BusyJay/subscriptions","organizations_url":"https://api.github.com/users/BusyJay/orgs","repos_url":"https://api.github.com/users/BusyJay/repos","events_url":"https://api.github.com/users/BusyJay/events{/privacy}","received_events_url":"https://api.github.com/users/BusyJay/received_events","type":"User","site_admin":false},"body":"Use `cmd.write_to_bytes()` instead.","created_at":"2017-04-19T11:28:05Z","updated_at":"2017-04-19T11:30:19Z","html_url":"https://github.com/pingcap/tikv/pull/1767#discussion_r112176963","pull_request_url":"https://api.github.com/repos/pingcap/tikv/pulls/1767","_links":{"self":{"href":"https://api.github.com/repos/pingcap/tikv/pulls/comments/112176963"},"html":{"href":"https://github.com/pingcap/tikv/pull/1767#discussion_r112176963"},"pull_request":{"href":"https://api.github.com/repos/pingcap/tikv/pulls/1767"}}},"pull_request":{"url":"https://api.github.com/repos/pingcap/tikv/pulls/1767","id":115726772,"html_url":"https://github.com/pingcap/tikv/pull/1767","diff_url":"https://github.com/pingcap/tikv/pull/1767.diff","patch_url":"https://github.com/pingcap/tikv/pull/1767.patch","issue_url":"https://api.github.com/repos/pingcap/tikv/issues/1767","number":1767,"state":"open","locked":false,"title":"bench: add serializtion bench case","user":{"login":"lishihai9017","id":670947,"avatar_url":"https://avatars3.githubusercontent.com/u/670947?v=3","gravatar_id":"","url":"https://api.github.com/users/lishihai9017","html_url":"https://github.com/lishihai9017","followers_url":"https://api.github.com/users/lishihai9017/followers","following_url":"https://api.github.com/users/lishihai9017/following{/other_user}","gists_url":"https://api.github.com/users/lishihai9017/gists{/gist_id}","starred_url":"https://api.github.com/users/lishihai9017/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lishihai9017/subscriptions","organizations_url":"https://api.github.com/users/lishihai9017/orgs","repos_url":"https://api.github.com/users/lishihai9017/repos","events_url":"https://api.github.com/users/lishihai9017/events{/privacy}","received_events_url":"https://api.github.com/users/lishihai9017/received_events","type":"User","site_admin":false},"body":"@BusyJay @zhangjinpeng1987 @siddontang PTAL","created_at":"2017-04-13T10:25:04Z","updated_at":"2017-04-19T11:30:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b2d4b7d281d3f022f2c30cdc42d91bf471aaa791","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/pingcap/tikv/pulls/1767/commits","review_comments_url":"https://api.github.com/repos/pingcap/tikv/pulls/1767/comments","review_comment_url":"https://api.github.com/repos/pingcap/tikv/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pingcap/tikv/issues/1767/comments","statuses_url":"https://api.github.com/repos/pingcap/tikv/statuses/bef6a816b26795896bca4d907983f360e934b9e1","head":{"label":"pingcap:lishihai/bench-serialization","ref":"lishihai/bench-serialization","sha":"bef6a816b26795896bca4d907983f360e934b9e1","user":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars0.githubusercontent.com/u/11855343?v=3","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"repo":{"id":48833910,"name":"tikv","full_name":"pingcap/tikv","owner":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars0.githubusercontent.com/u/11855343?v=3","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pingcap/tikv","description":"Distributed transactional key value database powered by Rust and Raft","fork":false,"url":"https://api.github.com/repos/pingcap/tikv","forks_url":"https://api.github.com/repos/pingcap/tikv/forks","keys_url":"https://api.github.com/repos/pingcap/tikv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pingcap/tikv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pingcap/tikv/teams","hooks_url":"https://api.github.com/repos/pingcap/tikv/hooks","issue_events_url":"https://api.github.com/repos/pingcap/tikv/issues/events{/number}","events_url":"https://api.github.com/repos/pingcap/tikv/events","assignees_url":"https://api.github.com/repos/pingcap/tikv/assignees{/user}","branches_url":"https://api.github.com/repos/pingcap/tikv/branches{/branch}","tags_url":"https://api.github.com/repos/pingcap/tikv/tags","blobs_url":"https://api.github.com/repos/pingcap/tikv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pingcap/tikv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pingcap/tikv/git/refs{/sha}","trees_url":"https://api.github.com/repos/pingcap/tikv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pingcap/tikv/statuses/{sha}","languages_url":"https://api.github.com/repos/pingcap/tikv/languages","stargazers_url":"https://api.github.com/repos/pingcap/tikv/stargazers","contributors_url":"https://api.github.com/repos/pingcap/tikv/contributors","subscribers_url":"https://api.github.com/repos/pingcap/tikv/subscribers","subscription_url":"https://api.github.com/repos/pingcap/tikv/subscription","commits_url":"https://api.github.com/repos/pingcap/tikv/commits{/sha}","git_commits_url":"https://api.github.com/repos/pingcap/tikv/git/commits{/sha}","comments_url":"https://api.github.com/repos/pingcap/tikv/comments{/number}","issue_comment_url":"https://api.github.com/repos/pingcap/tikv/issues/comments{/number}","contents_url":"https://api.github.com/repos/pingcap/tikv/contents/{+path}","compare_url":"https://api.github.com/repos/pingcap/tikv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pingcap/tikv/merges","archive_url":"https://api.github.com/repos/pingcap/tikv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pingcap/tikv/downloads","issues_url":"https://api.github.com/repos/pingcap/tikv/issues{/number}","pulls_url":"https://api.github.com/repos/pingcap/tikv/pulls{/number}","milestones_url":"https://api.github.com/repos/pingcap/tikv/milestones{/number}","notifications_url":"https://api.github.com/repos/pingcap/tikv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pingcap/tikv/labels{/name}","releases_url":"https://api.github.com/repos/pingcap/tikv/releases{/id}","deployments_url":"https://api.github.com/repos/pingcap/tikv/deployments","created_at":"2015-12-31T04:51:32Z","updated_at":"2017-04-19T11:28:06Z","pushed_at":"2017-04-19T11:05:20Z","git_url":"git://github.com/pingcap/tikv.git","ssh_url":"git@github.com:pingcap/tikv.git","clone_url":"https://github.com/pingcap/tikv.git","svn_url":"https://github.com/pingcap/tikv","homepage":"","size":7750,"stargazers_count":1743,"watchers_count":1743,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":165,"mirror_url":null,"open_issues_count":104,"forks":165,"open_issues":104,"watchers":1743,"default_branch":"master"}},"base":{"label":"pingcap:master","ref":"master","sha":"d68092a1612c4aa97b4ad1b63688d2f009dd1158","user":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars0.githubusercontent.com/u/11855343?v=3","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"repo":{"id":48833910,"name":"tikv","full_name":"pingcap/tikv","owner":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars0.githubusercontent.com/u/11855343?v=3","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pingcap/tikv","description":"Distributed transactional key value database powered by Rust and Raft","fork":false,"url":"https://api.github.com/repos/pingcap/tikv","forks_url":"https://api.github.com/repos/pingcap/tikv/forks","keys_url":"https://api.github.com/repos/pingcap/tikv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pingcap/tikv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pingcap/tikv/teams","hooks_url":"https://api.github.com/repos/pingcap/tikv/hooks","issue_events_url":"https://api.github.com/repos/pingcap/tikv/issues/events{/number}","events_url":"https://api.github.com/repos/pingcap/tikv/events","assignees_url":"https://api.github.com/repos/pingcap/tikv/assignees{/user}","branches_url":"https://api.github.com/repos/pingcap/tikv/branches{/branch}","tags_url":"https://api.github.com/repos/pingcap/tikv/tags","blobs_url":"https://api.github.com/repos/pingcap/tikv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pingcap/tikv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pingcap/tikv/git/refs{/sha}","trees_url":"https://api.github.com/repos/pingcap/tikv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pingcap/tikv/statuses/{sha}","languages_url":"https://api.github.com/repos/pingcap/tikv/languages","stargazers_url":"https://api.github.com/repos/pingcap/tikv/stargazers","contributors_url":"https://api.github.com/repos/pingcap/tikv/contributors","subscribers_url":"https://api.github.com/repos/pingcap/tikv/subscribers","subscription_url":"https://api.github.com/repos/pingcap/tikv/subscription","commits_url":"https://api.github.com/repos/pingcap/tikv/commits{/sha}","git_commits_url":"https://api.github.com/repos/pingcap/tikv/git/commits{/sha}","comments_url":"https://api.github.com/repos/pingcap/tikv/comments{/number}","issue_comment_url":"https://api.github.com/repos/pingcap/tikv/issues/comments{/number}","contents_url":"https://api.github.com/repos/pingcap/tikv/contents/{+path}","compare_url":"https://api.github.com/repos/pingcap/tikv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pingcap/tikv/merges","archive_url":"https://api.github.com/repos/pingcap/tikv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pingcap/tikv/downloads","issues_url":"https://api.github.com/repos/pingcap/tikv/issues{/number}","pulls_url":"https://api.github.com/repos/pingcap/tikv/pulls{/number}","milestones_url":"https://api.github.com/repos/pingcap/tikv/milestones{/number}","notifications_url":"https://api.github.com/repos/pingcap/tikv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pingcap/tikv/labels{/name}","releases_url":"https://api.github.com/repos/pingcap/tikv/releases{/id}","deployments_url":"https://api.github.com/repos/pingcap/tikv/deployments","created_at":"2015-12-31T04:51:32Z","updated_at":"2017-04-19T11:28:06Z","pushed_at":"2017-04-19T11:05:20Z","git_url":"git://github.com/pingcap/tikv.git","ssh_url":"git@github.com:pingcap/tikv.git","clone_url":"https://github.com/pingcap/tikv.git","svn_url":"https://github.com/pingcap/tikv","homepage":"","size":7750,"stargazers_count":1743,"watchers_count":1743,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":165,"mirror_url":null,"open_issues_count":104,"forks":165,"open_issues":104,"watchers":1743,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pingcap/tikv/pulls/1767"},"html":{"href":"https://github.com/pingcap/tikv/pull/1767"},"issue":{"href":"https://api.github.com/repos/pingcap/tikv/issues/1767"},"comments":{"href":"https://api.github.com/repos/pingcap/tikv/issues/1767/comments"},"review_comments":{"href":"https://api.github.com/repos/pingcap/tikv/pulls/1767/comments"},"review_comment":{"href":"https://api.github.com/repos/pingcap/tikv/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pingcap/tikv/pulls/1767/commits"},"statuses":{"href":"https://api.github.com/repos/pingcap/tikv/statuses/bef6a816b26795896bca4d907983f360e934b9e1"}}}}
{"actor":{"display_login":"BusyJay"}}