[vtk-developers] My vtk class override not being used when an override already exists.

David Thompson david.thompson at kitware.com
Mon Mar 4 21:33:58 EST 2013


> This looks good. Do you have a few spare cycles to investigate what it
> would take to do this in VTK?

Sure, but it will probably be the weekend.

> ... The broader question still remains though. Should this be enabled for every single class in VTK? My gut feeling says that we would exclude Common at the least. For one, I am not very comfortable with people overriding vtkDataArray for example. Also, it is still a potential performance problem even when doing something faster like hashing. What do you guys think?


I agree that for the case of instantiating many objects by hash value there could still be performance issues. Hashing replaces the string comparison with an integer comparison but, assuming we use a heap or tree to hold hashed values, there is still a log(N) cost.

A quick (and likely inaccurate) count of header files says N=2272. log2(N)=11.1, so expect 11 or 12 comparisons to look up a constructor. For a map, the bottleneck is that the hashes to be compared are non-local in memory, so it could be appreciable if done many times. However, if we use a heap stored as a vector of std::pair<unsigned int,pointer> (16 bytes per entry), the entire list of classes could fit in 35.5 kiB which is just a hair larger than the L1 cache on an Intel i7. My instinct is that VTK could grow quite a bit before the log(N) hash comparisons were an issue.

	David


More information about the vtk-developers mailing list