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
2 changed files with 5 additions and 4 deletions
Showing only changes of commit 1ec847f57f - Show all commits

View File

@ -7,8 +7,9 @@
namespace blender {
/**
* An #OffsetSpan where a constant offset is added to every value when accessed. This allows e.g.
* storing multiple `int64_t` indices as an array of `int16_t` with an additional `int64_t` offset.
* An #OffsetSpan is a #Span with a constant offset that is added to every value when accessed.
JacquesLucke marked this conversation as resolved Outdated

An #OffsetSpan where a constant -> An #OffsetSpan is a #Span with a constant

`An #OffsetSpan where a constant` -> `An #OffsetSpan is a #Span with a constant`
* This allows e.g. storing multiple `int64_t` indices as an array of `int16_t` with an additional
* `int64_t` offset.
*/
template<typename T, typename BaseT> class OffsetSpan {
private:

View File

@ -60,7 +60,7 @@ template<typename T> inline std::optional<IndexRange> non_empty_as_range_try(con
}
/**
* \return Amount of consecutive indices at the start of the span.
* \return Amount of consecutive indices at the start of the span. This takes O(log #indices) time.
*
* Example:
* [3, 4, 5, 6, 8, 9, 10]
@ -78,7 +78,7 @@ template<typename T> inline int64_t find_size_of_next_range(const Span<T> indice
/**
* \return Amount of non-consecutive indices until the next encoded range of at least
* #min_range_size elements starts.
* #min_range_size elements starts. This takes O(size_until_next_range) time.
*
* Example:
* [1, 2, 4, 6, 7, 8, 9, 10, 13];