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 6 additions and 6 deletions
Showing only changes of commit add5bd9b55 - Show all commits

View File

@ -151,8 +151,8 @@ struct CombOperationExecutor {
self_->curve_lengths_.reinitialize(curves_orig_->curves_num());
const Span<float> segment_lengths = self_->constraint_solver_.segment_lengths();
const OffsetIndices points_by_curve = curves_orig_->points_by_curve();
threading::parallel_for(curve_selection_.index_range(), 512, [&](const IndexRange range) {
for (const int curve_i : curve_selection_.slice(range)) {
curve_selection_.foreach_span_parallel(512, [&](auto mask_segment) {
for (const int curve_i : mask_segment) {
const IndexRange points = points_by_curve[curve_i];
const Span<float> lengths = segment_lengths.slice(points.drop_back(1));
self_->curve_lengths_[curve_i] = std::accumulate(lengths.begin(), lengths.end(), 0.0f);
@ -221,8 +221,8 @@ struct CombOperationExecutor {
const Span<float> segment_lengths = self_->constraint_solver_.segment_lengths();
threading::parallel_for(curve_selection_.index_range(), 256, [&](const IndexRange range) {
for (const int curve_i : curve_selection_.slice(range)) {
curve_selection_.foreach_span_parallel(256, [&](const auto mask_segment) {
for (const int curve_i : mask_segment) {
bool curve_changed = false;
const IndexRange points = points_by_curve[curve_i];
@ -340,8 +340,8 @@ struct CombOperationExecutor {
const OffsetIndices points_by_curve = curves_orig_->points_by_curve();
const Span<float> segment_lengths = self_->constraint_solver_.segment_lengths();
threading::parallel_for(curve_selection_.index_range(), 256, [&](const IndexRange range) {
for (const int curve_i : curve_selection_.slice(range)) {
curve_selection_.foreach_span_parallel(256, [&](const auto mask_segment) {
for (const int curve_i : mask_segment) {
bool curve_changed = false;
const IndexRange points = points_by_curve[curve_i];