Skip to content

Improve the runtime of some operations

Giuseppe Musacchio requested to merge speed-improvements into master

This MR contains two patches we've been using for some time, the quadratic behaviour shown by gmsh was unacceptable with the huge (~4k) number of 2D surfaces we need.

The first commit closes #2449 (closed) by replacing the linear lookup over a List_T of PhysicalGroups with a constant-time one over a Tree_T. The iteration over a Tree_T is a bit awkward with the Tree2List/List_Delete dance and could be improved by making Tree_Action accept a (capturing) C++ lambda, I'd be happy to contribute such patch if you deem this change worthwhile.

The second commit is what gave our code a massive boost, the "unsafe" unbinding method introduced in #404 is extended to boolean ops thus removing another quadratic lookup from the hot path. For our case (2D surfaces generated by boolean ops) no shortcoming has been noticed, I don't really know for the 3D case.

Merge request reports