Skip to content

Make vtkWrapHierarchy 5x faster on Windows

David Gobbi requested to merge dgobbi/vtk:wrap-stat-cache into master

When VTK's Python wrapper is used at application level, vtkWrapHierarchy takes several minutes to create hierarchy file for each larger library, because there are hundreds of include directories (all the directories of ITK, VTK, and other dependencies) and hundreds of header files to locate.

It turns out that the root cause is that on Windows, checking existence of a random file using stat function (or any Window-specific API) is very slow.

It is magnitudes faster to iterate through all the files in a folder. For example, iterating through a total of 17000 files in 600 include folders just takes 1-2 seconds. Therefore, checking existence of a file can be made about 5x faster by collecting a list of all the files in include directories and use that list to check if the file exists.

Co-authored-by: @lassoan

Edited by David Gobbi

Merge request reports

Loading