remove time wasting debug remainder from index position calculation -> performance improvement by factor 10-20
This commit is contained in:
parent
ce48f54e9b
commit
12ce081934
2 changed files with 10 additions and 5 deletions
|
@ -325,10 +325,17 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
block(blockIndex);
|
block(blockIndex);
|
||||||
second.block(blockIndex);
|
second.block(blockIndex);
|
||||||
|
//size_t cnt = 0;
|
||||||
|
//std::clock_t cs = clock();
|
||||||
for(*mIndex = 0; mIndex->pos() != mIndex->max(); mIndex->pp(blockIndexNum) ){
|
for(*mIndex = 0; mIndex->pos() != mIndex->max(); mIndex->pp(blockIndexNum) ){
|
||||||
|
//std::clock_t c1 = clock();
|
||||||
get() = mSecond.get();
|
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>
|
template <typename T, class OpClass, class... Ranges>
|
||||||
|
|
|
@ -167,9 +167,8 @@ namespace MultiArrayHelper
|
||||||
template <class... Indices>
|
template <class... Indices>
|
||||||
static size_t makePos(const std::tuple<std::shared_ptr<Indices>...>& iPtrTup)
|
static size_t makePos(const std::tuple<std::shared_ptr<Indices>...>& iPtrTup)
|
||||||
{
|
{
|
||||||
auto ID = std::get<N>(iPtrTup)->id();
|
const auto& idx = *std::get<N>(iPtrTup);
|
||||||
return std::get<N>(iPtrTup)->pos() +
|
return idx.pos() + RPackNum<N-1>::makePos(iPtrTup) * idx.max();
|
||||||
RPackNum<N-1>::makePos(iPtrTup) * std::get<N>(iPtrTup)->max();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Pack, class IndexType, class... Indices>
|
template <class Pack, class IndexType, class... Indices>
|
||||||
|
@ -328,7 +327,6 @@ namespace MultiArrayHelper
|
||||||
template <class... Indices>
|
template <class... Indices>
|
||||||
static size_t makePos(const std::tuple<std::shared_ptr<Indices>...>& iPtrTup)
|
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();
|
return std::get<0>(iPtrTup)->pos();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue