Why so slow? Waited 15 min for Rhino to join 1M quad meshes

@stevebaer,

I selected Mesh tools, clicked on the icon for single mesh face and created a quad mesh face. Then I copied this, rotated it so it intersected the original and joined them into a single mesh. Then I did an array copy of 1000 x 1000 of these meshes and joined them. After waiting 15 minutes, that’s 900 sec or 900,000,000 us (you get the idea) they were finally joined.

Why is this so slow? It should take only a few seconds. Any thoughts?

My C++ code for meshes with 100M faces (50X the size of the 2M faces mesh mentioned above) only takes seconds to do the most complicated of things, like check for self-intersecting faces (15 sec) or non-manifold edges (6 sec) or identical vertices (0.75 sec) or identical faces (1.7 sec) or corrupt faces (1.6 sec) or compute face-area weighted vertex normals (0.75 sec)). So I was astonished to see 15 minutes go by while Rhino joined the 1M face pairs to make a tiny mesh of 2M faces.

Regards,
Terry.

My guess is your code uses existing data on relationships of the vertices and faces are related in a single or very small number of meshes. Join would consider one million individual, separate faces as one million distinct objects without any pre-existing knowledge of how the objects are related.

David,

Here are some more details I what I am doing. My code is designed to import a mesh from a .obj file and repair any faults, sort of like combining Rhino’s import with the Mesh Wizard checks and repairs. It reads the .obj file, parses the contents to create a mesh or meshes (as dictated by the .obj file) and then constructs all the relationships it needs to do the checks I mentioned. It includes the option to join separate meshes into one. The code does not use any Rhino code for mesh topology manipulations. Instead it weaves together all the topological requirements of the different checks into an architecture that maximizes sharing. For example, when it is checking for corrupt faces and all the vertices are exposed, at low overhead it computes the face-center, the area of each face, the face normal and combines these latter 2 to create face-area-weighted face normals. These are later used to compute face-area-weighted vertex normals (something not offered in Rhino 7) which are computed using the same bins used to check in parallel for duplicate faces and the faces are sorted into bins using the previously computed face-centers. In this way the read of the 100M face mesh (4.8 GB) takes 2 sec and the checks, every one of which uses parallelism, are all done in 32 sec so the total time is 34 sec.

Perhaps I should try to use the mesh join routine in my code to join meshes that are already in the Rhino document. I am pretty sure it will only take a few sec. I use these constructed meshes to create test cases for my mesh import script. This has been very handy for flushing out problems. But it is really annoying to have to wait 15 minutes in order to create a tiny 2M face test case. I do not have the patience to wait the 750 min (12 hr+) it would take to create a more interesting 100M face test case.

Regards,
Terry.

It’s hard to tell if the delay is in the join command or in the fact that you are working with one million individual Rhino mesh objects. If you are building out test cases, I would recommend creating large meshes with a script that does the arraying of a mesh and joins all faces before creating any Rhino objects.

1 Like

I am still researching this. I want to get to the bottom of what is causing the slow join.