Adar Dembo has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/14445 )
Change subject: [tablet] Optimize TabletMetadata::CollectBlockIds efficiency ...................................................................... [tablet] Optimize TabletMetadata::CollectBlockIds efficiency Container size may reallocate and elements will be moved or copied several times if using std::vector and inserting elements at the beginning in TabletMetadata::CollectBlockIds, we'd better to insert elements at the end. We did some simple benchmarks for TabletMetadata::CollectBlockIds() operation in TestTabletMetadata.BenchmarkCollectBlockIds, compared with old version, result shows that inserting at the end provides a linear time cost when block count per RowSet or RowSet count increasing. And also, we ran benchmarks to compare std::vector with std::list and std::deque, both of them have worse efficiency. Result details as follow: (The first column is FLAGS_test_row_set_count/FLAGS_test_block_count_per_rs, the other columns show 10 times total TabletMetadata::CollectBlockIds() time cost, in millisecond.) vector list deque vector (head insert) (rear insert) 1000/1000 3464 687 334 321 2000/1000 15238 1390 647 613 4000/1000 75139 3057 1392 1212 8000/1000 328808 6593 2805 2736 4000/2000 159517 6488 2965 2462 4000/4000 348471 11967 5513 5141 4000/8000 -(too long) 23706 11704 10806 Change-Id: I7ce853e35eb7dfa9f9a099e465ea8edfaa7c4aa9 Reviewed-on: http://gerrit.cloudera.org:8080/14445 Tested-by: Kudu Jenkins Reviewed-by: Adar Dembo <a...@cloudera.com> --- M src/kudu/fs/block_id.h M src/kudu/tablet/delta_tracker.cc M src/kudu/tablet/diskrowset.cc M src/kudu/tablet/metadata-test.cc M src/kudu/tablet/rowset_metadata.cc M src/kudu/tablet/rowset_metadata.h M src/kudu/tablet/tablet_metadata-test.cc M src/kudu/tablet/tablet_metadata.cc M src/kudu/tablet/tablet_metadata.h M src/kudu/tools/kudu-tool-test.cc M src/kudu/tools/tool_action_fs.cc 11 files changed, 80 insertions(+), 38 deletions(-) Approvals: Kudu Jenkins: Verified Adar Dembo: Looks good to me, approved -- To view, visit http://gerrit.cloudera.org:8080/14445 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I7ce853e35eb7dfa9f9a099e465ea8edfaa7c4aa9 Gerrit-Change-Number: 14445 Gerrit-PatchSet: 8 Gerrit-Owner: Yingchun Lai <405403...@qq.com> Gerrit-Reviewer: Adar Dembo <a...@cloudera.com> Gerrit-Reviewer: Alexey Serbin <aser...@cloudera.com> Gerrit-Reviewer: Kudu Jenkins (120) Gerrit-Reviewer: Tidy Bot (241) Gerrit-Reviewer: Yingchun Lai <405403...@qq.com>