View Issue Details

IDProjectCategoryView StatusLast Update
0002642Slicer4Core: Base Codepublic2017-09-27 10:56
ReporterfinetjulAssigned Tofinetjul 
PrioritynormalSeverityminorReproducibilityhave not tried
Status acknowledgedResolutionopen 
Product VersionSlicer 4.1.1 
Target VersionbacklogFixed in Version 
Summary0002642: Speed up scene event invocations
Description

a) See what has been done in VTK 6:
https://github.com/Kitware/VTK/commit/58687b53f04b59c8a4c33bb4bca4662c92b4b75c
https://github.com/Kitware/VTK/commit/1ed2a37f999fcbac69b3c313ed2bfae7435427dc

b) If we call NodeRemovedEvent on each removed node (in addition to invoking the event on the scene), we should be able to speed up Slicer. Observers will then observe only the nodes they care about, it should decrease the size of the (unsorted) list of scene observers and speed-up each scene event invocation.
See vtkMRMLLayoutLogic::LayoutNode

TagsNo tags attached.

Relationships

related to 0002810 resolvedalexy Performance problems with model display 

Activities

finetjul

finetjul

2012-10-29 08:18

administrator   ~0006845

Last edited: 2013-01-17 11:19

c) Speedup vtkEventBroker::RemoveObservations():

  • Don't look up SubjectMap[subjectKey] twice (SubjectMap can be as big as 10^4)
  • push_back can be expensive when creating big vectors. Consider using "reserve"
  • maybe doing "erase" would be faster than creating a new array each time.

d) Speedup vtkEventBroker::GetObservations():

  • Don't lookup SubjectMap[subjectKey] for each loop iteration.
  • construct observationList at the beginning of the function to avoid a copy in optimization mode.

e) Speedup vtkEventBroker::GetObservationsForSubjectByTag():

  • Unnecessary vector copies are happening (e.g. subjectList).

f) Speedup ctkVTKConnection:

  • Converting from const char to QString can be expensive, this is the case in ctkVTKObjectEventsObserverPrivate::findConnection() when the conversion happens many times. Moreover, the Qt signal/slot signature uses const char, so it should also probably be const char*.

g) Speedup vtkMRMLScene::RemoveReferencedNodeID

  • By reserving the space, push_backs will be faster
finetjul

finetjul

2012-10-29 09:17

administrator   ~0006852

Last edited: 2013-01-17 11:19

h) Review vtkMRMLModelDisplayableManager::UpdateFromMRML()

  • It probably doesn't need to remove the props each time a display[able] node is added: (called from vtkMRMLModelDisplayableManager::OnMRMLSceneNodeAdded in RequestRender)
finetjul

finetjul

2012-10-29 09:24

administrator   ~0006854

Last edited: 2013-01-17 11:19

i) Improve performance of vtkPiecewiseFunction::RemovePoint:
Just search the array once (use std::distance() to find if the point is found)
Speedup vtkPiecewiseFunction::DeepCopy:

  • Fire only 1 modified event. Currently, each time a point is added, the range is changed and calls Modified().
  • As a temporary solution, one can block Modified Event invocation on vtkMRMLVolumePropertyNode when the piecewise function of vtkVolumeProperty is modified: Call StartModify on vspNode->GetVolumePropertyNode() in vtkSlicerVolumeRenderingLogic::CopyLabelMapDisplayToVolumeRenderingDisplayNode and in vtkSlicerVolumeRenderingLogic::CopyScalarDisplayToVolumeRenderingDisplayNode
  • Temporary solution implemented in r21278
finetjul

finetjul

2013-01-17 11:21

administrator   ~0007699

a) fixed in r21580
c), d) and e) fixed in r21581
f) fixed in r21582
g) fixed in r21583

finetjul

finetjul

2013-02-18 07:09

administrator   ~0007977

j) vtkEventBroker should have maximum 1 observation (AnyEvent) on a vtkObject. It should then redirect the events to observers.

finetjul

finetjul

2013-10-11 04:55

administrator   ~0010172

k) vtkMRMLSliceLogic::UpdateSliceNode could be speed up by not calling vtkMRMLScene::GetNthNodeByClass. This method should be reviewed to improve performance.

finetjul

finetjul

2013-12-10 08:49

administrator   ~0010423

i) Exposing vtkMRMLSliceNode::GetRASToXY() (have the matrix cached maybe) would prevent many matrix inversions in the code (e.g. in the displayable managers)

finetjul

finetjul

2014-01-10 14:10

administrator   ~0010504

Last edited: 2014-01-10 15:11

j) speed-up slice view zoom by wrapping SetFieldOfView and UpdateMatrices with Start/EndModify in vtkSliceViewInteractorStyle. This actually does not reduce the number of time observers are triggered because vtkMRMLSliceLogic::OnMRMLNodeModified() might actually trigger a new ModifiedEvent inside SetSliceExtentsToSliceNode() -> SetUVWExtentsAndDimensions() -> UpdateMatrices().

A second issue might comes from vtkSetAndObserveMRMLNodeEventsMacro in vtkMRMLAbstractLogic. If it is called twice, the 2nd time the old node value is not "unobserved". This can lead to errors or duplicated calls if it is done twice in a row.

finetjul

finetjul

2014-01-24 07:13

administrator   ~0010534

k) Add vtkMRMLDisplayableNode::SetAndObserveDisplayNode()
convenient method that prevents a "search" in the mrml scene node collection

jcfr

jcfr

2014-05-13 11:09

administrator   ~0011786

@Julien: Re-targetting minor issue from 4.4 to 4.5

Related Changesets

Slicer: 2145-support-for-installing-extension-from-file 9ecca3f0

2013-01-10 12:51:01

finetjul

Details Diff
ENH: Add Scene Performance test

It measures time spent by some scene actions such as loading, closing,
restoring, relayouting a scene or modifying/adding nodes.
Issue 0002642

Example of performance on a MacBookPro laptop (2.4GHz):
AddData (BrainAtlas2012.mrb) took 44865 msecs
CloseScene () took 28706 msecs
AddData (BrainAtlas2012.mrb) took 44579 msecs
ModifyNode (vtkMRMLScalarVolumeNode1) took 4 msecs
ModifyNode (vtkMRMLScalarVolumeNode2) took 35 msecs
ModifyNode (vtkMRMLScalarVolumeNode3) took 20 msecs
ModifyNode (vtkMRMLModelHierarchyNode2) took 14 msecs
ModifyNode (vtkMRMLModelNode4) took 0 msecs
ModifyNode (vtkMRMLModelDisplayNode5) took 14 msecs
ModifyNode (vtkMRMLModelHierarchyNode3) took 13 msecs
ModifyNode (vtkMRMLModelStorageNode1) took 4 msecs
ModifyNode (vtkMRMLModelHierarchyNode301) took 18 msecs
ModifyNode (vtkMRMLModelDisplayNode304) took 23 msecs
ModifyNode (vtkMRMLModelHierarchyNode51) took 19 msecs
AddNode (vtkMRMLModelNode302) took 46 msecs

git-svn-id: http://svn.slicer.org/Slicer4/trunk@21579 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Applications/SlicerApp/Testing/Python/CMakeLists.txt Diff File
add - Applications/SlicerApp/Testing/Python/Resources/UI/ScenePerformance.ui Diff File
add - Applications/SlicerApp/Testing/Python/ScenePerformance.py Diff File
mod - Base/QTCore/qSlicerCoreIOManager.cxx Diff File
mod - Base/QTCore/qSlicerCoreIOManager.h Diff File

Slicer: 2145-support-for-installing-extension-from-file 8fade71e

2013-01-10 12:51:04

finetjul

Details Diff
ENH: Speed-up vtkObject event invokes

Issue 0002642

Example of performance on a MacBookPro laptop:
AddData (BrainAtlas2012.mrb) took 39877 msecs
CloseScene () took 26271 msecs
CloseScene () took 136 msecs
AddData (BrainAtlas2012.mrb) took 36945 msecs
ModifyNode (vtkMRMLScalarVolumeNode1) took 4 msecs
ModifyNode (vtkMRMLScalarVolumeNode2) took 28 msecs
ModifyNode (vtkMRMLScalarVolumeNode3) took 16 msecs
ModifyNode (vtkMRMLModelHierarchyNode2) took 13 msecs
ModifyNode (vtkMRMLModelNode5) took 1 msecs
ModifyNode (vtkMRMLModelNode4) took 0 msecs
ModifyNode (vtkMRMLModelDisplayNode5) took 12 msecs
ModifyNode (vtkMRMLModelHierarchyNode3) took 12 msecs
ModifyNode (vtkMRMLModelStorageNode1) took 4 msecs
ModifyNode (vtkMRMLModelHierarchyNode301) took 17 msecs
ModifyNode (vtkMRMLModelDisplayNode304) took 21 msecs
ModifyNode (vtkMRMLModelHierarchyNode302) took 17 msecs
AddNode (vtkMRMLModelNode5) took 90 msecs
AddNode (vtkMRMLModelNode302) took 45 msecs

git-svn-id: http://svn.slicer.org/Slicer4/trunk@21580 3bd1e089-480b-0410-8dfb-8563597acbee
mod - SuperBuild/External_VTK.cmake Diff File

Slicer: 2145-support-for-installing-extension-from-file 8a52eb38

2013-01-10 12:51:08

finetjul

Details Diff
ENH: Speed-up vtkEventBroker

Issue 0002642

Example of performance on a MacBookPro laptop:
AddData (BrainAtlas2012.mrb) took 37541 msecs
CloseScene () took 26276 msecs
CloseScene () took 117 msecs
AddData (BrainAtlas2012.mrb) took 37057 msecs
ModifyNode (vtkMRMLScalarVolumeNode1) took 4 msecs
ModifyNode (vtkMRMLScalarVolumeNode2) took 26 msecs
ModifyNode (vtkMRMLScalarVolumeNode3) took 15 msecs
ModifyNode (vtkMRMLScalarVolumeDisplayNode2) took 22 msecs
ModifyNode (vtkMRMLModelHierarchyNode2) took 10 msecs
ModifyNode (vtkMRMLModelNode4) took 0 msecs
ModifyNode (vtkMRMLModelDisplayNode5) took 11 msecs
ModifyNode (vtkMRMLModelHierarchyNode3) took 11 msecs
ModifyNode (vtkMRMLModelStorageNode1) took 4 msecs
AddNode (vtkMRMLModelNode302) took 41 msecs
Layout (3) took 52 msecs
Layout (2) took 18 msecs
RestoreSceneView (vtkMRMLSceneViewNode15) took 2911 msecs
RestoreSceneView (vtkMRMLSceneViewNode15) took 1608 msecs

git-svn-id: http://svn.slicer.org/Slicer4/trunk@21581 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Libs/MRML/Core/vtkEventBroker.cxx Diff File

Slicer: 2145-support-for-installing-extension-from-file 92aefb88

2013-01-10 12:51:11

finetjul

Details Diff
ENH: Speed-up ctkVTKConnection

Issue 0002642

Example of performance on a MacBookPro laptop:
AddData (BrainAtlas2012.mrb) took 32574 msecs
CloseScene () took 24954 msecs
CloseScene () took 104 msecs
AddData (BrainAtlas2012.mrb) took 30087 msecs
ModifyNode (vtkMRMLScalarVolumeNode1) took 4 msecs
ModifyNode (vtkMRMLScalarVolumeNode1) took 3 msecs
ModifyNode (vtkMRMLScalarVolumeNode2) took 25 msecs
ModifyNode (vtkMRMLScalarVolumeNode3) took 16 msecs
ModifyNode (vtkMRMLScalarVolumeDisplayNode2) took 22 msecs
ModifyNode (vtkMRMLModelHierarchyNode2) took 10 msecs
ModifyNode (vtkMRMLModelNode4) took 0 msecs
ModifyNode (vtkMRMLModelDisplayNode5) took 11 msecs
ModifyNode (vtkMRMLModelHierarchyNode3) took 10 msecs
ModifyNode (vtkMRMLModelStorageNode1) took 4 msecs
AddNode (vtkMRMLModelNode302) took 31 msecs
Layout (3) took 66 msecs
Layout (2) took 20 msecs
Layout (3) took 53 msecs
Layout (2) took 19 msecs
RestoreSceneView (vtkMRMLSceneViewNode15) took 2730 msecs
RestoreSceneView (vtkMRMLSceneViewNode15) took 1556 msecs

git-svn-id: http://svn.slicer.org/Slicer4/trunk@21582 3bd1e089-480b-0410-8dfb-8563597acbee
mod - SuperBuild/External_CTK.cmake Diff File

Slicer: 2145-support-for-installing-extension-from-file 2bcb4e76

2013-01-10 12:51:15

finetjul

Details Diff
ENH: Speed-up vtkMRMLScene references

Issue 0002642

Example of performance on a MacBookPro laptop:
AddData (BrainAtlas2012.mrb) took 30911 msecs
CloseScene () took 21943 msecs
CloseScene () took 76 msecs
AddData (BrainAtlas2012.mrb) took 29535 msecs
ModifyNode (vtkMRMLScalarVolumeNode1) took 4 msecs
ModifyNode (vtkMRMLScalarVolumeNode2) took 25 msecs
ModifyNode (vtkMRMLScalarVolumeDisplayNode2) took 23 msecs
ModifyNode (vtkMRMLScalarVolumeNode3) took 15 msecs
ModifyNode (vtkMRMLModelHierarchyNode2) took 10 msecs
ModifyNode (vtkMRMLModelNode4) took 0 msecs
ModifyNode (vtkMRMLModelDisplayNode5) took 11 msecs
ModifyNode (vtkMRMLModelHierarchyNode3) took 11 msecs
ModifyNode (vtkMRMLModelStorageNode1) took 5 msecs
AddNode (vtkMRMLModelNode302) took 31 msecs
Layout (3) took 9 msecs
Layout (2) took 27 msecs
Layout (3) took 50 msecs
RestoreSceneView (vtkMRMLSceneViewNode15) took 2701 msecs
RestoreSceneView (vtkMRMLSceneViewNode15) took 1542 msecs

git-svn-id: http://svn.slicer.org/Slicer4/trunk@21583 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Libs/MRML/Core/vtkMRMLScene.cxx Diff File

Slicer: 2145-support-for-installing-extension-from-file cf8212ba

2013-01-10 18:38:02

finetjul

Details Diff
ENH: Speed-up qMRMLSceneModel node observation

Don't listen to nodes that are filtered out by the sort&filter proxy model.
Issue 0002642

Example of performance on MacBookPro laptop:
AddData (BrainAtlas2012.mrb) took 22741 msecs -10000msecs
CloseScene () took 11827 msecs -10000msecs
AddData (BrainAtlas2012.mrb) took 20909 msecs
ModifyNode (vtkMRMLScalarVolumeNode1) took 4 msecs
ModifyNode (vtkMRMLScalarVolumeNode2) took 24 msecs
ModifyNode (vtkMRMLScalarVolumeDisplayNode2) took 22 msecs
ModifyNode (vtkMRMLScalarVolumeNode3) took 15 msecs
ModifyNode (vtkMRMLModelHierarchyNode2) took 10 msecs
ModifyNode (vtkMRMLModelNode4) took 0 msecs
ModifyNode (vtkMRMLModelDisplayNode5) took 11 msecs
ModifyNode (vtkMRMLModelHierarchyNode3) took 10 msecs
ModifyNode (vtkMRMLModelStorageNode1) took 0 msecs
AddNode (vtkMRMLModelNode302) took 20 msecs
Layout (3) took 51 msecs
Layout (2) took 24 msecs
RestoreSceneView (vtkMRMLSceneViewNode15) took 865 msecs -1000msecs
RestoreSceneView (vtkMRMLSceneViewNode15) took 622 msecs

git-svn-id: http://svn.slicer.org/Slicer4/trunk@21586 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Libs/MRML/Widgets/Testing/qMRMLSceneModelTest.cxx Diff File
mod - Libs/MRML/Widgets/Testing/qMRMLTreeViewEventTranslatorPlayerTest1.cxx Diff File
mod - Libs/MRML/Widgets/qMRMLNodeComboBox.cxx Diff File
mod - Libs/MRML/Widgets/qMRMLSceneModel.cxx Diff File
mod - Libs/MRML/Widgets/qMRMLSceneModel.h Diff File
mod - Libs/MRML/Widgets/qMRMLSceneModel_p.h Diff File
mod - Libs/MRML/Widgets/qMRMLSortFilterHierarchyProxyModel.cxx Diff File
mod - Libs/MRML/Widgets/qMRMLSortFilterHierarchyProxyModel.h Diff File
mod - Libs/MRML/Widgets/qMRMLSortFilterProxyModel.cxx Diff File
mod - Libs/MRML/Widgets/qMRMLSortFilterProxyModel.h Diff File
mod - Libs/MRML/Widgets/qMRMLTreeView.cxx Diff File
mod - Libs/MRML/Widgets/qMRMLTreeView.h Diff File
mod - Modules/Loadable/Data/Resources/UI/qSlicerDataModule.ui Diff File
mod - Modules/Loadable/Models/Resources/UI/qSlicerModelsModule.ui Diff File
mod - Modules/Loadable/TractographyDisplay/Widgets/qMRMLSceneTractographyDisplayModel.cxx Diff File
mod - Modules/Loadable/Transforms/Resources/UI/qSlicerTransformsModule.ui Diff File
mod - SuperBuild/External_OpenIGTLinkIF.cmake Diff File

Issue History

Date Modified Username Field Change
2012-10-15 06:11 finetjul New Issue
2012-10-15 06:11 finetjul Status new => assigned
2012-10-15 06:11 finetjul Assigned To => finetjul
2012-10-29 08:18 finetjul Note Added: 0006845
2012-10-29 09:15 finetjul Note Edited: 0006845
2012-10-29 09:17 finetjul Note Added: 0006852
2012-10-29 09:24 finetjul Note Added: 0006854
2012-10-29 09:31 finetjul Note Edited: 0006854
2012-10-29 12:52 finetjul Note Edited: 0006845
2012-10-29 13:13 finetjul Note Edited: 0006845
2012-10-29 13:16 finetjul Note Edited: 0006845
2012-10-29 16:12 finetjul Note Edited: 0006854
2012-12-13 15:09 finetjul Note Edited: 0006854
2013-01-17 11:18 finetjul Description Updated
2013-01-17 11:19 finetjul Note Edited: 0006845
2013-01-17 11:19 finetjul Note Edited: 0006852
2013-01-17 11:19 finetjul Note Edited: 0006854
2013-01-17 11:21 finetjul Note Added: 0007699
2013-02-18 07:09 finetjul Note Added: 0007977
2013-08-09 04:21 finetjul Target Version Slicer 4.3.0 => Slicer 4.4.0
2013-09-30 05:41 inorton Relationship added related to 0002810
2013-10-11 04:55 finetjul Note Added: 0010172
2013-12-10 08:49 finetjul Note Added: 0010423
2014-01-10 14:10 finetjul Note Added: 0010504
2014-01-10 14:42 finetjul Note Edited: 0010504
2014-01-10 15:11 finetjul Note Edited: 0010504
2014-01-24 07:13 finetjul Note Added: 0010534
2014-05-13 11:09 jcfr Note Added: 0011786
2014-05-13 11:11 jcfr Target Version Slicer 4.4.0 => Slicer 4.5.0-1
2014-05-13 12:50 jcfr Status assigned => acknowledged
2015-11-02 11:58 jcfr Target Version Slicer 4.5.0-1 => Slicer 4.6.0
2016-10-12 15:12 jcfr Target Version Slicer 4.6.0 => Slicer 4.7.0
2017-06-07 23:27 finetjul Changeset attached => Slicer 2145-support-for-installing-extension-from-file cf8212ba
2017-06-07 23:27 finetjul Changeset attached => Slicer 2145-support-for-installing-extension-from-file 2bcb4e76
2017-06-07 23:27 finetjul Changeset attached => Slicer 2145-support-for-installing-extension-from-file 92aefb88
2017-06-07 23:27 finetjul Changeset attached => Slicer 2145-support-for-installing-extension-from-file 8a52eb38
2017-06-07 23:27 finetjul Changeset attached => Slicer 2145-support-for-installing-extension-from-file 8fade71e
2017-06-07 23:27 finetjul Changeset attached => Slicer 2145-support-for-installing-extension-from-file 9ecca3f0
2017-09-27 10:56 lassoan Target Version Slicer 4.7.0 => backlog