You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@quickstep.apache.org by na...@apache.org on 2016/06/11 04:06:23 UTC
incubator-quickstep git commit: Avoid repeatedly invoking vector
size()
Repository: incubator-quickstep
Updated Branches:
refs/heads/fix_avoid_vector_size [created] 7182914dc
Avoid repeatedly invoking vector size()
Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/7182914d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/7182914d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/7182914d
Branch: refs/heads/fix_avoid_vector_size
Commit: 7182914dc8002320d49d9d85f335db357c65b9fb
Parents: 659967a
Author: Navneet Potti <na...@apache.org>
Authored: Fri Jun 10 23:05:54 2016 -0500
Committer: Navneet Potti <na...@apache.org>
Committed: Fri Jun 10 23:05:54 2016 -0500
----------------------------------------------------------------------
storage/ValueAccessor.hpp | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/7182914d/storage/ValueAccessor.hpp
----------------------------------------------------------------------
diff --git a/storage/ValueAccessor.hpp b/storage/ValueAccessor.hpp
index e2a898e..f772666 100644
--- a/storage/ValueAccessor.hpp
+++ b/storage/ValueAccessor.hpp
@@ -504,6 +504,7 @@ class OrderedTupleIdSequenceAdapterValueAccessor : public ValueAccessor {
: accessor_(accessor),
owned_accessor_(take_ownership_of_accessor ? accessor : nullptr),
id_sequence_(id_sequence),
+ id_seqence_size_(id_sequence.size()),
current_position_(std::numeric_limits<OrderedTupleIdSequence::size_type>::max()) {
static_assert(std::numeric_limits<OrderedTupleIdSequence::size_type>::is_modulo,
"size_type does not support modulo overflow.");
@@ -529,12 +530,12 @@ class OrderedTupleIdSequenceAdapterValueAccessor : public ValueAccessor {
}
inline bool iterationFinished() const {
- return current_position_ + 1 >= id_sequence_.size();
+ return current_position_ + 1 >= id_sequence_size_;
}
inline bool next() {
++current_position_;
- return current_position_ != id_sequence_.size();
+ return current_position_ != id_sequence_size_;
}
inline void previous() {
@@ -551,7 +552,7 @@ class OrderedTupleIdSequenceAdapterValueAccessor : public ValueAccessor {
}
inline tuple_id getNumTuples() const {
- return id_sequence_.size();
+ return id_sequence_size_;
}
template <bool check_null = true>
@@ -674,6 +675,7 @@ class OrderedTupleIdSequenceAdapterValueAccessor : public ValueAccessor {
InternalValueAccessorType *accessor_;
std::unique_ptr<InternalValueAccessorType> owned_accessor_;
const OrderedTupleIdSequence &id_sequence_;
+ const std::size_t id_sequence_size_;
OrderedTupleIdSequence::size_type current_position_;
DISALLOW_COPY_AND_ASSIGN(OrderedTupleIdSequenceAdapterValueAccessor);