[Bf-blender-cvs] [ff048f5d27c] master: Curves: Avoid virtual function overhead when finding selected curves

Hans Goudey noreply at git.blender.org
Wed Jul 27 22:42:28 CEST 2022


Commit: ff048f5d27c4b785f5d6807eb14416ff308ca5ef
Author: Hans Goudey
Date:   Wed Jul 27 15:34:29 2022 -0500
Branches: master
https://developer.blender.org/rBff048f5d27c4b785f5d6807eb14416ff308ca5ef

Curves: Avoid virtual function overhead when finding selected curves

This showed up on a profile of sculpting with the comb brush.
Use a span instead of a virtual array.

===================================================================

M	source/blender/editors/sculpt_paint/curves_sculpt_selection.cc

===================================================================

diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_selection.cc b/source/blender/editors/sculpt_paint/curves_sculpt_selection.cc
index 5bfc8ccc667..a955a074df2 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_selection.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_selection.cc
@@ -67,10 +67,11 @@ static IndexMask retrieve_selected_curves(const CurvesGeometry &curves,
         return selection.get_internal_single() <= 0.0f ? IndexMask(0) :
                                                          IndexMask(curves.curves_num());
       }
+      const Span<float> point_selection_span = selection.get_internal_span();
       return index_mask_ops::find_indices_based_on_predicate(
           curves.curves_range(), 512, r_indices, [&](const int curve_i) {
             for (const int i : curves.points_for_curve(curve_i)) {
-              if (selection[i] > 0.0f) {
+              if (point_selection_span[i] > 0.0f) {
                 return true;
               }
             }



More information about the Bf-blender-cvs mailing list