You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I profile tree construction, one main bottleneck I see is that multiple GCs have to happen due to the amount of garbage that gets created. Here are a few categories of things that we construct:
MeshBVHNodes. Of course, we need nodes in our tree.
Spheres, Box3s, and their underlying Vector3s. It seems like we mostly need to store different bounding boxes and spheres for all of our nodes, so this is hard to avoid.
For each node, the array of triangle indices in that node. This one is interesting. We need that list at each level when we are constructing child nodes, but we only need to store it permanently for leaf nodes; the arrays of triangles for intermediate nodes are discarded. It could be possible to rework the construction algorithm to not construct so many intermediate arrays.
For each node, lambdas referring to that node and its split volumes, to put into the creation queue. This one is also interesting. It seems like if we reworked the construction algorithm, the processing queue could just be a queue of nodes, where the meaning of each entry is "this node needs to be split." That would save us creating the lambdas.
3 and 4 could be productive avenues for optimizing tree construction.
The text was updated successfully, but these errors were encountered:
Another idea: right now the split strategy code returns a temporary object with the split parameters (axis and coordinate.) Instead, the split strategy code could populate the new bounding box and partitioned triangle arrays directly.
Everything I wrote in here is now fixed up except for the very last comment. By the way, it looks like on the example page nowadays, one GC almost always still has to happen during tree construction, so further improvements are still probably helpful.
When I profile tree construction, one main bottleneck I see is that multiple GCs have to happen due to the amount of garbage that gets created. Here are a few categories of things that we construct:
MeshBVHNode
s. Of course, we need nodes in our tree.Sphere
s,Box3
s, and their underlyingVector3
s. It seems like we mostly need to store different bounding boxes and spheres for all of our nodes, so this is hard to avoid.3 and 4 could be productive avenues for optimizing tree construction.
The text was updated successfully, but these errors were encountered: