Page MenuHome

Geometry Nodes: Improve performance of mesh to points node
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Apr 15 2022, 4:10 PM.

Details

Summary

I did some investigation into the performance of the mesh to points node.
There are fancier possibilities for improvements, like taking ownership
of existing arrays in some cases, but this patch takes a simpler brute
force approach for now.

The first change is to move from the previous loop to using the new
materialize_compressed_to_uninitialized method on virtual arrays,
which adds only the selected values to the output. That is a nice
improvement in some cases, corresponding to the "Without Threading"
column in the chart below.

The next change is to call that function in parallel on slices of
the output. To avoid generating too much code, we can avoid
templating based on the type and devirtualizing completely.

The test input is a 4 million point grid, generated by the grid primitive node.
Color and 2D vector attributes were also transferred to the points.

TestBeforeFinal No ThreadingFinalChange
All Verts209 ms186 ms170 ms0.8x
0.01 Selection148 ms143 ms133 ms0.9x
All Faces326 ms303 ms87 ms0.27x
0.01 Selection Faces70 ms68 ms34 ms0.49x

One curious result is that moving from faces ended up being faster
than from vertices. I don't understand why that is yet.

Diff Detail

Repository
rB Blender

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Apr 15 2022, 4:10 PM
Hans Goudey (HooglyBoogly) created this revision.
This revision is now accepted and ready to land.May 4 2022, 3:30 PM