You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2020/04/23 23:12:23 UTC

[kudu] 01/02: tablet: set up RowSetKeyProbe fields in initialization list

This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 1bdfbac5737411ee2de5a557eb198eaa12cf4873
Author: Todd Lipcon <to...@apache.org>
AuthorDate: Wed Apr 22 22:50:18 2020 -0700

    tablet: set up RowSetKeyProbe fields in initialization list
    
    For some reason, setting these fields in the body of the constructor
    generated a lot more code than setting them in the constructor list.
    Namely, the setting of a unique_ptr<> generated a check whether the
    pointer was already set, and code to deallocate the old version if it
    was.
    
    I'm not sure why clang couldn't figure out that it couldn't possibly be
    set -- perhaps something to do with inheritance (eg maybe a subclass
    would have set the field in its constructor before chaining upwards?).
    Either way, this was taking 2-3% CPU and dropped after this change.
    
    Change-Id: Ibe46e00f5ca8c13c7366df4bee04e7c6e840b3a0
    Reviewed-on: http://gerrit.cloudera.org:8080/15790
    Reviewed-by: Bankim Bhavsar <ba...@cloudera.com>
    Tested-by: Kudu Jenkins
---
 src/kudu/tablet/rowset.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/kudu/tablet/rowset.h b/src/kudu/tablet/rowset.h
index 85c8c99..40e4e71 100644
--- a/src/kudu/tablet/rowset.h
+++ b/src/kudu/tablet/rowset.h
@@ -317,9 +317,9 @@ class RowSetKeyProbe {
   // NOTE: row_key is not copied and must be valid for the lifetime
   // of this object.
   explicit RowSetKeyProbe(ConstContiguousRow row_key)
-      : row_key_(row_key) {
-    encoded_key_ = EncodedKey::FromContiguousRow(row_key_);
-    bloom_probe_ = BloomKeyProbe(encoded_key_slice());
+      : row_key_(row_key),
+        encoded_key_(EncodedKey::FromContiguousRow(row_key_)),
+        bloom_probe_(BloomKeyProbe(encoded_key_slice())) {
   }
 
   // RowSetKeyProbes are usually allocated on the stack, which means that we