[vtkusers] Import time in Python

David Gobbi david.gobbi at gmail.com
Thu Aug 18 02:12:05 EDT 2016


YMMV, but on my ancient 2009 MacBook Pro, 2 cores, 2.53GHz, 4GB RAM, here
is the time to execute "import vtk":

$ time bin/vtkpython import_vtk.py
real 0m1.851s
user 0m0.640s
sys 0m0.448s

And on the second try (when the libs are in disk cache):

$ time bin/vtkpython import_vtk.py
real 0m0.612s
user 0m0.485s
sys 0m0.120s

So if my system takes 0.6s to import VTK, while yours takes 7s, that
suggests that something funny is going on. Does anyone else want to chime
in with their experience with loading VTK into Python?

 - David


On Wed, Aug 17, 2016 at 9:17 AM, Andrea Gavana <andrea.gavana at gmail.com>
wrote:

> Hello,
>
>      I have recently installed VTK 7.0 to be used via Python 2.7 using the
> excellent resources from Christoph Gohlke (http://www.lfd.uci.edu/~gohlk
> e/pythonlibs/). I have a considerably powerful machine at work - 96 GB
> RAM, 8 cores, 64 bit Windows 7 Enterprise. However, executing the simple
> command below:
>
> import vtk
>
> takes more than 7 seconds on this machine. I understand that there are
> quite a few modules to import in the VTK hierarchy, but I was not expecting
> such a dramatically slow operation. I also understand that this may not be
> the perfect forum to post such a question, but maybe someone else has
> encountered a similar behavior and he/she has some explanation for it.
>
> Any suggestion is more than welcome, thank you in advance. I paste below
> the results of profiling the simple import statement using the Python
> profiler in this way:
>
> python -m cProfile test_import_vtk.py
>
>
> Andrea.
>
>
> *File Name                            Import Time (seconds)*
> vtkIOImage.py                        0.190
> vtkIOExodus.py                       0.151
> vtkCommonCore.py                     0.147
> vtkRenderingOpenGL2.py               0.124
> vtkRenderingFreeType.py              0.120
> vtkIOInfovis.py                      0.113
> vtkIOParallel.py                     0.106
> vtkIONetCDF.py                       0.103
> vtkCommonColor.py                    0.102
> vtkFiltersStatistics.py              0.101
> vtkFiltersVerdict.py                 0.100
> vtkGeovisCore.py                     0.100
> vtkIOAMR.py                          0.100
> vtkIOXMLParser.py                    0.099
> vtkIOMovie.py                        0.097
> vtkCommonDataModel.py                0.096
> vtkCommonMath.py                     0.091
> vtkCommonMisc.py                     0.091
> vtkInteractionWidgets.py             0.091
> vtkRenderingVolume.py                0.090
> vtkCommonComputationalGeometry.py    0.088
> vtkFiltersModeling.py                0.087
> vtkIOMINC.py                         0.087
> vtkIOSQL.py                          0.087
> vtkInfovisCore.py                    0.087
> vtkFiltersHybrid.py                  0.085
> vtkIOPLY.py                          0.085
> vtkFiltersCore.py                    0.084
> vtkImagingGeneral.py                 0.084
> vtkRenderingLabel.py                 0.083
> vtkImagingMath.py                    0.082
> vtkInfovisLayout.py                  0.082
> vtkCommonExecutionModel.py           0.081
> vtkIOCore.py                         0.081
> vtkFiltersGeneric.py                 0.080
> vtkIOEnSight.py                      0.080
> vtkViewsContext2D.py                 0.080
> vtkFiltersAMR.py                     0.079
> vtkFiltersParallelImaging.py         0.079
> vtkImagingCore.py                    0.079
> vtkImagingFourier.py                 0.079
> vtkInteractionImage.py               0.079
> vtkInteractionStyle.py               0.079
> vtkRenderingContext2D.py             0.079
> vtkImagingColor.py                   0.078
> vtkRenderingImage.py                 0.078
> vtkRenderingVolumeOpenGL2.py         0.078
> vtkFiltersPython.py                  0.077
> vtkIOParallelXML.py                  0.077
> vtkImagingStatistics.py              0.077
> vtkViewsInfovis.py                   0.077
> vtkFiltersSources.py                 0.076
> vtkIOVideo.py                        0.076
> vtkFiltersFlowPaths.py               0.075
> vtkFiltersParallel.py                0.075
> vtkFiltersSMP.py                     0.075
> vtkFiltersSelection.py               0.075
> vtkIOImport.py                       0.075
> vtkImagingHybrid.py                  0.075
> vtkRenderingAnnotation.py            0.075
> vtkDomainsChemistry.py               0.073
> vtkFiltersImaging.py                 0.073
> vtkRenderingCore.py                  0.073
> vtkIOExport.py                       0.072
> vtkIOLegacy.py                       0.072
> vtkRenderingContextOpenGL2.py        0.072
> vtkCommonTransforms.py               0.071
> vtkFiltersGeneral.py                 0.071
> vtkIOLSDyna.py                       0.071
> vtkImagingMorphological.py           0.071
> vtkImagingStencil.py                 0.071
> vtkIOXML.py                          0.070
> vtkImagingSources.py                 0.070
> vtkFiltersGeometry.py                0.069
> vtkFiltersHyperTree.py               0.069
> vtkFiltersProgrammable.py            0.069
> vtkCommonSystem.py                   0.068
> vtkParallelCore.py                   0.067
> vtkDomainsChemistryOpenGL2.py        0.066
> vtkFiltersExtraction.py              0.066
> vtkRenderingLOD.py                   0.065
> vtkFiltersTexture.py                 0.063
> vtkViewsCore.py                      0.061
> vtkChartsCore.py                     0.060
> vtkIOGeometry.py                     0.059
>
> *Total                                7.119*
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160818/09ee6d95/attachment-0001.html>


More information about the vtkusers mailing list