remove time wasting debug remainder from index position calculation -> performance improvement by factor 10-20

This commit is contained in:
Christian Zimmermann 2017-12-18 19:02:43 +01:00
parent ce48f54e9b
commit 12ce081934
2 changed files with 10 additions and 5 deletions

View file

@ -325,10 +325,17 @@ namespace MultiArrayTools
block(blockIndex);
second.block(blockIndex);
//size_t cnt = 0;
//std::clock_t cs = clock();
for(*mIndex = 0; mIndex->pos() != mIndex->max(); mIndex->pp(blockIndexNum) ){
//std::clock_t c1 = clock();
get() = mSecond.get();
//std::clock_t c2 = clock();
//cnt += c2 - c1;
}
//std::clock_t ce = clock();
//std::cout << "total time = " << ce - cs << std::endl;
//std::cout << "calc time = " << cnt << std::endl;
}
template <typename T, class OpClass, class... Ranges>

View file

@ -167,9 +167,8 @@ namespace MultiArrayHelper
template <class... Indices>
static size_t makePos(const std::tuple<std::shared_ptr<Indices>...>& iPtrTup)
{
auto ID = std::get<N>(iPtrTup)->id();
return std::get<N>(iPtrTup)->pos() +
RPackNum<N-1>::makePos(iPtrTup) * std::get<N>(iPtrTup)->max();
const auto& idx = *std::get<N>(iPtrTup);
return idx.pos() + RPackNum<N-1>::makePos(iPtrTup) * idx.max();
}
template <class Pack, class IndexType, class... Indices>
@ -328,7 +327,6 @@ namespace MultiArrayHelper
template <class... Indices>
static size_t makePos(const std::tuple<std::shared_ptr<Indices>...>& iPtrTup)
{
auto ID = std::get<0>(iPtrTup)->id();
return std::get<0>(iPtrTup)->pos();
}