<div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Dear Sir or Madam,</div><div><br></div><div>some more details on the previously-reported case of extremely slow parsing of a gmsh file:<br></div><div>The file contains 34795 points -- of which 23041 points are "Point In Volume" (e.g. embedded_vertices of a GRegion?). Moreover, it contains 4998 "Plane Surface"s and one single "Volume". Almost all plane surfaces are triangles and quads -- except for <10 facets, which each have a very high vertex count (typ. 7000).</div><div><br></div><div>I found out that if I remove all "Point In Volume" objects, then the parsing takes only 20 seconds. However, if all the "Point In Volume" objects are not removed, parsing takes around 3000 seconds. This led me to the hypothesis that there is some huge inefficiency with parsing gmsh files with "Point In Volume" (probably quadratic run time in N(PointInVolume)??).</div><div><br></div><div>Furthermore, I analyzed the runs using "perf" (linux utility).<br>Run 1 (about 3000 seconds):</div><div>  $ time perf record ./gmsh-3.0.6-Linux64/bin/gmsh -1 input_orig.geo</div><div>
<div>Run 2 (about 20 seconds):</div><div>  $ time perf record ./gmsh-3.0.6-Linux64/bin/gmsh -1 input_no_point_in_volume.geo</div><div>In Run 1, "perf report" yields the following top-scoring functions:</div><div>  11.57%  gmsh     gmsh                 [.] GModel::getEdgeByTag<br>   7.73%  gmsh     gmsh                 [.] GEO_Internals::synchronize<br>   6.80%  gmsh     <a href="http://libc-2.12.so">libc-2.12.so</a>         [.] _int_free<br>   6.31%  gmsh     gmsh                 [.] GModel::getVertexByTag<br>   4.91%  gmsh     <a href="http://libc-2.12.so">libc-2.12.so</a>         [.] malloc<br>   4.53%  gmsh     gmsh                 [.] InterpolateCurve<br>   4.40%  gmsh     libstdc++.so.6.0.22  [.] std::_Rb_tree_increment<br>   3.88%  gmsh     <a href="http://libc-2.12.so">libc-2.12.so</a>         [.] memcpy<br>   3.69%  gmsh     gmsh                 [.] List_Nbr<br>   3.35%  gmsh     <a href="http://libc-2.12.so">libc-2.12.so</a>         [.] _int_malloc<br>   3.24%  gmsh     gmsh                 [.] GEntity::GEntity<br>   3.13%  gmsh     gmsh                 [.] avl_lookup<br>   2.63%  gmsh     gmsh                 [.] gmshFace::resetNativePtr<br>   2.53%  gmsh     gmsh                 [.] GEdge::addFace<br>   2.52%  gmsh     gmsh                 [.] CompareVertex<br>   1.97%  gmsh     gmsh                 [.] std::_List_base<GEdge*, std::allocator<GEdge*><br>   1.88%  gmsh     gmsh                 [.] GModel::getFaceByTag<br>   1.76%  gmsh     gmsh                 [.] Tree_Action<br>   1.74%  gmsh     gmsh                 [.] gmshEdge::degenerate<br>   1.63%  gmsh     gmsh                 [.] CompareCurve<br>   1.53%  gmsh     gmsh                 [.] std::_List_base<int, std::allocator<int> >::_M<br>   1.38%  gmsh     gmsh                 [.] GModel::deletePhysicalGroups<br>   1.23%  gmsh     gmsh                 [.] std::_List_base<GEdgeSigned, std::allocator<GE<br>   1.10%  gmsh     gmsh                 [.] GVertex::addEdge<br>   0.85%  gmsh     gmsh                 [.] List_Read<br>   0.75%  gmsh     gmsh                 [.] GEdge::getBeginVertex<br>   0.73%  gmsh     gmsh                 [.] GFace::computeMeanPlane<br>   0.73%  gmsh     <a href="http://libc-2.12.so">libc-2.12.so</a>         [.] free<br>   0.67%  gmsh     gmsh                 [.] CTX::instance<br>   0.65%  gmsh     gmsh                 [.] gmshEdge::resetMeshAttributes<br></div><div><br></div><div>This suggests that maybe 
GModel::getEdgeByTag is eventually called a quadratic number of times in the number of PointInVolume-objects -- and this causes the drastic slow-down.</div><div><br></div><div>Could you please investigate this? Thanks a lot!</div><div>(As already mentioned, this issue also occurs with gmsh-4.x.x)<br></div><div><br></div><div>Best regards</div><div>A. S.<br></div>

</div></div></div></div>