# Question about instancing efficiency between vtk8.2 and vtk9.0

**URL:** <https://discourse.slicer.org/t/question-about-instancing-efficiency-between-vtk8-2-and-vtk9-0/23885>\
**Category:** Support\
**Created:** [June 15, 2022, 3:44am UTC](https://discourse.slicer.org/t/question-about-instancing-efficiency-between-vtk8-2-and-vtk9-0/23885 "2022-06-15T03:44:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xianger-qi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/xianger-qi/32/11944_2.png) [@xianger-qi](https://discourse.slicer.org/u/xianger-qi)\
**Post date:** [June 15, 2022, 3:44am UTC](https://discourse.slicer.org/t/question-about-instancing-efficiency-between-vtk8-2-and-vtk9-0/23885/1 "2022-06-15T03:44:42Z")

</div>

Hey guys, i took a test about variable instancing efficiency between vtk8.2 and vtk9.0 on different class.  
Here was what i got:

testing times: 10000  
Statistical method: average instancing time  
the method instancing: vtkSmartPointer《class》 variable = vtkSmartPointer《class》::New();

VTK 9.0.3:  
vtkGenericCell: 1.5002 us  
vtkSphere: 0.0703 us  
vtkSTLReader: 4.3552 us

====================================

VTK 8.2:  
vtkGenericCell: 8.6075 us  
vtkSphere: 0.2852 us  
vtkSTLReader: 34.239 us

There are two questions for me.  
FIRST, on the different version vtk, the same classes have significant instancing time that approximately is 10 times, and is there any optimizations?  
SECOND, on the same version vtk, the different classes also have significant instancing time. what causes the difference?

Thanks for your reading!

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [June 15, 2022, 12:10pm UTC](https://discourse.slicer.org/t/question-about-instancing-efficiency-between-vtk8-2-and-vtk9-0/23885/2 "2022-06-15T12:10:29Z")

</div>

FYI, This would be a better topic for the vtk discourse. In general though I think it’s good that the times are going down. To know exactly why you would need to look at the constructors for the various classes and if you are really interested you could use a code profiler to see where the time is being spent.
