a806f1c8663f87defa2f58f676c0c2fd453958cc
Adds new function `foreach_content_slice_by_offsets` that gathers mask's
indices into `IndexRange` lists grouped by given offsets. New approach
doesn't need temporary `points_to_duplicate` array of size
`curves.points_num()`. Traversal is more effective as only selected
indices get visited. Also point data is copied by point ranges instead
of point by point.
Performance was tested with following code:
```cpp
TEST(curves_geometry, DuplicatePoints)
{
CurvesGeometry curves = create_basic_curves(100000, 100);
IndexMaskMemory memory;
IndexMask every_second = IndexMask::from_predicate(
curves.points_range(), GrainSize(100), memory, [](const int i) {
return bool(i % 2);
});
for (const int i : IndexRange(1000)) {
CurvesGeometry copy = curves;
const int expected_point_count = copy.points_num() + every_second.size();
ed::curves::duplicate_points(copy, every_second);
EXPECT_EQ(copy.points_num(), expected_point_count);
}
}
```
| | main | mask slices | slices & copy by ranges |
| -------- | -------- | ----------- | ----------------------- |
| full copy| 3346 ms | 2270 ms | 1614 ms |
| `i % 2` | 8084 ms | 5918 ms | 5112 ms |
| `!((i % 10 == 0) or` <br/>`(i % 10 == 1) or` <br/>`(i % 10 == 2))` | 4522 ms | 2860 ms | 2343 ms|
| `(i % 10 == 0) or` <br/> `(i % 10 == 1) or` <br/> `(i % 10 == 2)`| 4088 ms | 1961 ms | 1639 ms|
| `IndexRange(50020, 70)` <br/> <sub>(one small range in the middle)</sub>| 1966 ms | 100 ms | ~75 ms |
Pull Request: https://projects.blender.org/blender/blender/pulls/133101
…
Blender
Blender is the free and open source 3D creation suite. It supports the entirety of the 3D pipeline-modeling, rigging, animation, simulation, rendering, compositing, motion tracking and video editing.
Project Pages
Development
License
Blender as a whole is licensed under the GNU General Public License, Version 3. Individual files may have a different, but compatible license.
See blender.org/about/license for details.
Description
Languages
C++
78%
Python
14.9%
C
2.9%
GLSL
1.9%
CMake
1.2%
Other
0.9%
