Todd Lipcon has posted comments on this change. ( http://gerrit.cloudera.org:8080/15042 )
Change subject: cfile: change BlockBuilder API to yield a vector of Slices ...................................................................... Patch Set 1: (9 comments) http://gerrit.cloudera.org:8080/#/c/15042/1/src/kudu/cfile/binary_dict_block.cc File src/kudu/cfile/binary_dict_block.cc: http://gerrit.cloudera.org:8080/#/c/15042/1/src/kudu/cfile/binary_dict_block.cc@65 PS1, Line 65: void BinaryDictBlockBuilder::Reset() { > Is it necessary to clear the buffer_ member as well? nope, because it's always completely overwritten in Finish(). I'll rename it to header_buf http://gerrit.cloudera.org:8080/#/c/15042/1/src/kudu/cfile/binary_dict_block.cc@85 PS1, Line 85: data_slices.insert(data_slices.begin(), Slice(buffer_)); : *slices = std::move(data_slices); > Inserting into the beginning of a vector is not the best option from the pe isn't that equivalent from a performnace perspective? in either case, you're ending up copying all of the data_slices once (in your case to append to ret, in my case when inserting at the beginning). http://gerrit.cloudera.org:8080/#/c/15042/1/src/kudu/cfile/binary_plain_block.h File src/kudu/cfile/binary_plain_block.h: http://gerrit.cloudera.org:8080/#/c/15042/1/src/kudu/cfile/binary_plain_block.h@85 PS1, Line 85: static const size_t kHeaderSize = sizeof(uint32_t) * 3; > nit: would it benefit from adding constexpr ? Done http://gerrit.cloudera.org:8080/#/c/15042/1/src/kudu/cfile/binary_plain_block.cc File src/kudu/cfile/binary_plain_block.cc: http://gerrit.cloudera.org:8080/#/c/15042/1/src/kudu/cfile/binary_plain_block.cc@59 PS1, Line 59: buffer_.resize(kHeaderSize); : buffer_.reserve(options_->storage_attributes.cfile_block_size); > Would it be more optimal to switch these two lines? Done http://gerrit.cloudera.org:8080/#/c/15042/1/src/kudu/cfile/bshuf_block.h File src/kudu/cfile/bshuf_block.h: http://gerrit.cloudera.org:8080/#/c/15042/1/src/kudu/cfile/bshuf_block.h@53 PS1, Line 53: using std::vector; > Is it really needed? yea not sure how it got there, thanks http://gerrit.cloudera.org:8080/#/c/15042/1/src/kudu/cfile/cfile_writer.cc File src/kudu/cfile/cfile_writer.cc: http://gerrit.cloudera.org:8080/#/c/15042/1/src/kudu/cfile/cfile_writer.cc@399 PS1, Line 399: null_bitmap > nit: wrap into std::move() ? I think given Slice is a simple value type there isn't any benefit to moving vs copying (otherwise I think clang-tidy would complain here) http://gerrit.cloudera.org:8080/#/c/15042/1/src/kudu/cfile/cfile_writer.cc@401 PS1, Line 401: for (const auto& s : data_slices) { : v.emplace_back(s); : } > nit: consider instead Done http://gerrit.cloudera.org:8080/#/c/15042/1/src/kudu/cfile/encoding-test.cc File src/kudu/cfile/encoding-test.cc: http://gerrit.cloudera.org:8080/#/c/15042/1/src/kudu/cfile/encoding-test.cc@127 PS1, Line 127: contiguous_buf_ > Is it possible to use just a local variable instead this member field and m nope, because the Slice doesn't own the pointed-to memory, so it has to outlast the function call scope http://gerrit.cloudera.org:8080/#/c/15042/1/src/kudu/cfile/rle_block.h File src/kudu/cfile/rle_block.h: http://gerrit.cloudera.org:8080/#/c/15042/1/src/kudu/cfile/rle_block.h@78 PS1, Line 78: buf_ > Slice(buf_) ? Or the compiler is smart enough to wrap it into a Slice itse yea, Slice has an implicit constructor for faststring apparently -- To view, visit http://gerrit.cloudera.org:8080/15042 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Ifc7a5f148a4a43cedac2428f4c1a18d0f93a10db Gerrit-Change-Number: 15042 Gerrit-PatchSet: 1 Gerrit-Owner: Todd Lipcon <t...@apache.org> Gerrit-Reviewer: Alexey Serbin <aser...@cloudera.com> Gerrit-Reviewer: Andrew Wong <aw...@cloudera.com> Gerrit-Reviewer: Kudu Jenkins (120) Gerrit-Reviewer: Todd Lipcon <t...@apache.org> Gerrit-Comment-Date: Thu, 16 Jan 2020 06:12:59 +0000 Gerrit-HasComments: Yes