BMesh: Optimize copying attributes from many elements at once #115824

Merged
Hans Goudey merged 9 commits from HooglyBoogly/blender:bmesh-cd-copy-performance-fix into main 2023-12-09 05:37:47 +01:00

9 Commits

Author SHA1 Message Date
Hans Goudey 57c9c6fae8 Remove "with map" suffix and remove old function 2023-12-08 09:34:32 -05:00
Hans Goudey 4110ed7ec9 Merge branch 'main' into bmesh-cd-copy-performance-fix 2023-12-08 09:21:51 -05:00
Hans Goudey 673664bf54 Merge branch 'main' into bmesh-cd-copy-performance-fix 2023-12-07 19:25:58 -05:00
Hans Goudey 496f823998 Improve comments 2023-12-07 17:26:41 -05:00
Hans Goudey ed3170c1ba Merge branch 'main' into bmesh-cd-copy-performance-fix 2023-12-07 17:20:28 -05:00
Hans Goudey 22b40965da Don't inline "low level" copying in BMesh python code 2023-12-07 10:00:03 -05:00
Hans Goudey 9acb056f86 Order map arguments after containers 2023-12-07 09:59:41 -05:00
Hans Goudey 5b7989b8db Merge branch 'main' into bmesh-cd-copy-performance-fix 2023-12-07 09:43:12 -05:00
Hans Goudey 119a9bba4e BMesh: Optimize copying attributes from many elements at once
Fixes #115776

Create a minimal structure that contains the instructions necessary to
copy from one custom data format to another. This structure is similar
to the one used in dfacaf4f40. It should have been used in
9175d9b7c2, which instead introduced quadratic performance
relative to the number of layers when copying every element.

A few areas in BMesh are changed to use this map:
- Copying the entire mesh
- Adding a custom data layer (attribute)

The non-map attribute copy functions are also changed to check for when
the source and result BMeshes are the same. In that case it's much
faster to call the "same format" function from 9175d9b7c2.

For numbers, the timings are arbitrarily influenced by how many layers
I add in my testing. With many very many layers, a 10x difference is
easily observable though.
2023-12-05 22:34:02 -05:00