summaryrefslogtreecommitdiffstats
path: root/eval
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-12-19 14:33:02 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2017-12-19 17:01:30 +0100
commit566ed854f6a2e88efaf2d9aff871ea3fc24bbd83 (patch)
treef4c4bf67584dc910f83aaa9d221ed0f14697f776 /eval
parent70d5625eceb6d3cab86f4f5c3bfac4a13e03b8db (diff)
Avoid type conversion and also use a presized address scratchpad
Diffstat (limited to 'eval')
-rw-r--r--eval/src/vespa/eval/tensor/dense/dense_tensor_address_combiner.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/eval/src/vespa/eval/tensor/dense/dense_tensor_address_combiner.cpp b/eval/src/vespa/eval/tensor/dense/dense_tensor_address_combiner.cpp
index eee2755fe9a..fc77c0a954d 100644
--- a/eval/src/vespa/eval/tensor/dense/dense_tensor_address_combiner.cpp
+++ b/eval/src/vespa/eval/tensor/dense/dense_tensor_address_combiner.cpp
@@ -21,7 +21,7 @@ public:
: _address(address),
_idx(0)
{}
- size_t nextLabel() {
+ Address::value_type nextLabel() {
return _address[_idx++];
}
bool valid() {
@@ -56,31 +56,33 @@ DenseTensorAddressCombiner::DenseTensorAddressCombiner(const eval::ValueType &lh
_ops.push_back(AddressOp::RHS);
++rhsItr;
}
+ _combinedAddress.resize(_ops.size());
}
bool
DenseTensorAddressCombiner::combine(const CellsIterator &lhsItr,
const CellsIterator &rhsItr)
{
- _combinedAddress.clear();
+ uint32_t index(0);
AddressReader lhsReader(lhsItr.address());
AddressReader rhsReader(rhsItr.address());
for (const auto &op : _ops) {
switch (op) {
case AddressOp::LHS:
- _combinedAddress.emplace_back(lhsReader.nextLabel());
+ _combinedAddress[index] = lhsReader.nextLabel();
break;
case AddressOp::RHS:
- _combinedAddress.emplace_back(rhsReader.nextLabel());
+ _combinedAddress[index] = rhsReader.nextLabel();
break;
case AddressOp::BOTH:
- size_t lhsLabel = lhsReader.nextLabel();
- size_t rhsLabel = rhsReader.nextLabel();
+ Address::value_type lhsLabel = lhsReader.nextLabel();
+ Address::value_type rhsLabel = rhsReader.nextLabel();
if (lhsLabel != rhsLabel) {
return false;
}
- _combinedAddress.emplace_back(lhsLabel);
+ _combinedAddress[index] = lhsLabel;
}
+ index++;
}
return true;
}