Files
test/source
Hans Goudey 98e33adac2 Mesh: Further optimize topology map creation
We need a separate array that we can change in during the parallel
group construction. That array tells where in each group the index
is added. Building this array is expensive, since construcing a new
`Array` fills its elements serially. There are two possible solutions:

1. Use a copy of the offsets to increment result indices directly
2. Rely on OS-optimized `calloc` instead of `malloc` and a copy/fill

Both depend on using `fetch_and_add` instead of `add_and_fetch`.

The vertex to corner and edge to corner map creation is optimized
by this commit, though the benefits will be useful elsewhere in the
future.

|          | Before  | 1. offsets copy | 2. calloc       |
| -------- | ------- | --------------- | --------------- |
| Grid 1m  | 3.1 ms  | 1.9 ms (1.63x)  | 1.8 ms (1.72x)  |
| Grid 16m | 51.8 ms | 33.3 ms (1.55x) | 32.7 ms (1.58x) |

This commit implements the calloc solution, since it's slightly faster
and simpler. In the future, `Array` could do this optimization itself
when it detects that its fill value is just zero bytes.

Pull Request: https://projects.blender.org/blender/blender/pulls/112065
2023-09-08 16:18:38 +02:00
..