diff options
author | Hans Goudey <h.goudey@me.com> | 2022-03-24 07:27:26 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-03-24 07:27:26 +0300 |
commit | 610ec34c1f7dbd28f0e3f31b3bb79c52fa97d2cb (patch) | |
tree | cfd289a4d551c34ba105f086ee61dfecdfa0d45c /source/blender/blenlib/intern | |
parent | aeb2c2afaf00d1c1ef6cce73b106d5400e52566e (diff) |
Geometry Nodes: Improve performance writing to vertex groups
In a test file from T96282, this commit reduces the runtime of the
delete geometry node from 82 ms to 23 ms, a 3.6x improvement.
Writing to vertex groups in other cases should be faster too.
The largest improvement comes from not writing a new weight
of zero if the vertex is not in the group. This mirrors the behavior
of custom data interpolation in `layerInterp_mdeformvert`.
Other improvements come from using `set_all` for writing
output attributes and implementing that method for vertex groups.
I also implemented `materialize` methods. Though I didn't obverse
an improvement from this, I think it's best to remove virtual method
call overhead where it's simple to do so.
The test file for the delete geometry node needs to be updated.
These methods could be parallelized too, but better to do that later.
Differential Revision: https://developer.blender.org/D14420
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/generic_virtual_array.cc | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/source/blender/blenlib/intern/generic_virtual_array.cc b/source/blender/blenlib/intern/generic_virtual_array.cc index c6abf3624e1..8a6ef8e792f 100644 --- a/source/blender/blenlib/intern/generic_virtual_array.cc +++ b/source/blender/blenlib/intern/generic_virtual_array.cc @@ -391,10 +391,7 @@ void GVMutableArray_GSpan::save() if (data_ != owned_data_) { return; } - const int64_t element_size = type_->size(); - for (int64_t i : IndexRange(size_)) { - varray_.set_by_copy(i, POINTER_OFFSET(owned_data_, element_size * i)); - } + varray_.set_all(owned_data_); } void GVMutableArray_GSpan::disable_not_applied_warning() |