BLI: refactor IndexMask for better performance and memory usage #104629

Merged
Jacques Lucke merged 254 commits from JacquesLucke/blender:index-mask-refactor into main 2023-05-24 18:11:47 +02:00
1 changed files with 7 additions and 7 deletions
Showing only changes of commit d9ca4b4c8d - Show all commits

View File

@ -215,13 +215,6 @@ template<typename T> IndexMask to_index_mask(const Span<T> indices, LinearAlloca
chunk.segments_num = segments_in_chunk_num;
}
auto take_front_and_drop = [](auto &span, const int64_t n) {
auto front = span.take_front(n);
BLI_assert(front.size() == n);
span = span.drop_front(n);
return front;
};
MutableSpan<int16_t> remaining_indices;
MutableSpan<const int16_t *> remaining_indices_by_segment;
MutableSpan<int16_t> remaining_cumulative_segment_sizes;
@ -237,6 +230,13 @@ template<typename T> IndexMask to_index_mask(const Span<T> indices, LinearAlloca
const OffsetIndices<int64_t> segments_by_chunk = segments_per_chunk_cumulative.as_span();
const auto take_front_and_drop = [](auto &span, const int64_t n) {
auto front = span.take_front(n);
BLI_assert(front.size() == n);
span = span.drop_front(n);
return front;
};
for (const int64_t i : IndexRange(slice.size())) {
const IndexRange segments_in_chunk = segments_by_chunk[i];
const int16_t segments_num = int16_t(segments_in_chunk.size());