From 2dd22e54495b145a12931add763b7fcc4521ae10 Mon Sep 17 00:00:00 2001 From: Siying Dong Date: Mon, 11 Sep 2017 11:43:17 -0700 Subject: [PATCH] Make DBIter class final Summary: DBIter is referenced in ArenaWrappedDBIter, which is a simple wrapper. If DBIter is final, some virtual function call can be avoided. Some functions can even be inlined, like DBIter.value() to ArenaWrappedDBIter.value() and DBIter.key() to ArenaWrappedDBIter.key(). The performance gain is hard to measure. I just ran the memory-only benchmark for readseq and saw it didn't regress. There shouldn't be any harm doing it. Just give compiler more choices. Closes https://github.com/facebook/rocksdb/pull/2859 Differential Revision: D5799888 Pulled By: siying fbshipit-source-id: 829788f91310c40282dcfb7e412e6ef489931143 --- db/db_iter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/db_iter.cc b/db/db_iter.cc index 33f926ce0..16fcf9f79 100644 --- a/db/db_iter.cc +++ b/db/db_iter.cc @@ -50,7 +50,7 @@ static void DumpInternalIter(Iterator* iter) { // combines multiple entries for the same userkey found in the DB // representation into a single entry while accounting for sequence // numbers, deletion markers, overwrites, etc. -class DBIter: public Iterator { +class DBIter final: public Iterator { public: // The following is grossly complicated. TODO: clean it up // Which direction is the iterator currently moving? -- GitLab