[vtkusers] vtkPoints + speed

Jeff Baumes jeff.baumes at kitware.com
Tue Mar 23 09:20:57 EDT 2010


> i wanted to know if it is faster to use SetNumberOfPoints()+SetPoint() or
> just the InsertPoint() ?
> I know the first solution is written to be faster, but is it actually?
> I tried some tests (grid with ~80K points and 400K cells) and i found no
> real difference.

SetPoint() is constant time, and InsertPoint() is amortized constant
time when used to fill an array, so it makes sense that there is no
major difference. The only difference is that InsertPoint() uses log N
allocations and memory copies over the time of filling the array. But
InsertPoint() may also fragment your memory more, so I still think
SetPoint() should be preferred.

Jeff



More information about the vtkusers mailing list