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

[5/5] kudu git commit: cfile_writer: inline written_size() method

cfile_writer: inline written_size() method

This method shows up as consuming 1% of the CPU in a heavy write
workload. It's just a getter so should just be inlined and will avoid
some CPU.

Change-Id: I40b140b283899ba8ce05e08f01e28d943c2ab6af
Reviewed-on: http://gerrit.cloudera.org:8080/6434
Reviewed-by: David Ribeiro Alves <dr...@apache.org>
Reviewed-by: Andrew Wong <aw...@cloudera.com>
Tested-by: Kudu Jenkins


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/47520a7e
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/47520a7e
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/47520a7e

Branch: refs/heads/master
Commit: 47520a7e8822a5fbbfd44155475ed2b8a540f768
Parents: 6ce5129
Author: Todd Lipcon <to...@apache.org>
Authored: Sun Mar 19 16:35:53 2017 -0700
Committer: Todd Lipcon <to...@apache.org>
Committed: Wed Mar 22 22:28:53 2017 +0000

----------------------------------------------------------------------
 src/kudu/cfile/cfile_writer.cc | 7 -------
 src/kudu/cfile/cfile_writer.h  | 7 ++++++-
 2 files changed, 6 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/47520a7e/src/kudu/cfile/cfile_writer.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/cfile_writer.cc b/src/kudu/cfile/cfile_writer.cc
index f0407dd..4c0e352 100644
--- a/src/kudu/cfile/cfile_writer.cc
+++ b/src/kudu/cfile/cfile_writer.cc
@@ -442,13 +442,6 @@ Status CFileWriter::AppendRawBlock(const vector<Slice> &data_slices,
   return s;
 }
 
-size_t CFileWriter::written_size() const {
-  // This is a low estimate, but that's OK -- this is checked after every block
-  // write during flush/compact, so better to give a fast slightly-inaccurate result
-  // than spend a lot of effort trying to improve accuracy by a few KB.
-  return off_;
-}
-
 Status CFileWriter::AddBlock(const vector<Slice> &data_slices,
                              BlockPointer *block_ptr,
                              const char *name_for_log) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/47520a7e/src/kudu/cfile/cfile_writer.h
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/cfile_writer.h b/src/kudu/cfile/cfile_writer.h
index e619c2a..37816c9 100644
--- a/src/kudu/cfile/cfile_writer.h
+++ b/src/kudu/cfile/cfile_writer.h
@@ -148,7 +148,12 @@ class CFileWriter {
 
   // Return the amount of data written so far to this CFile.
   // More data may be written by Finish(), but this is an approximation.
-  size_t written_size() const;
+  size_t written_size() const {
+    // This is a low estimate, but that's OK -- this is checked after every block
+    // write during flush/compact, so better to give a fast slightly-inaccurate result
+    // than spend a lot of effort trying to improve accuracy by a few KB.
+    return off_;
+  }
 
   // Return the number of values written to the file.
   // This includes NULL cells, but does not include any "raw" blocks