Archived issue #0026139
AIS_InteractiveContext::Display performance regression
Description
Displaying AIS_IO now requires more time than earlier. AIS_InteractiveContext::Display spends 95% of time to add AIS_IO to selection manager, 75% of which is spent to find element in NCollection_BaseSequence [see attachments]. NCollection_BaseSequence usage seems to be ineffective to store objects and indexes in SelectMgr_SensitiveEntitySet, because it has a lot of access operations.
Steps to reproduce
test bugs vis bug26139
Additional information
Public activity
25 archived notes
Participants are labeled by their role within this record.
Replacing NCollection_BaseSequence with std::deque the hotspot has gone and AIS_InteractiveContext::Display has sped up by 2.5x.
Branch [archived branch] has been created by Author.
[revision removed]
Detailed log of new commits:
Author: Sergey Solomin
Date: Fri Apr 24 23:18:06 2015 +0300
0026139: AIS_InteractiveContext::Display performance regression
Replacing NCollection_BaseSequence with std::deque
[revision removed]
Detailed log of new commits:
Author: Sergey Solomin
Date: Fri Apr 24 23:18:06 2015 +0300
0026139: AIS_InteractiveContext::Display performance regression
Replacing NCollection_BaseSequence with std::deque
I've published my changes which give 2.5x speed-up displaying my model.
I believe the class SelectMgr_SensitiveSet and around must be refactored:
- there is no sense in maintaining myEntityIdxs sequence, it does not bring anything apart of extra indirection. To sort the objects, you can instead swap them directly in their own container, so that index is always direct.
- vector can be used instead of sequence or deque. When removing element from the set, for efficiency it can be first swapped with the last one, then the last removed
- in Swap(), use std::swap()
- class BVH_Set lacks documentation: at a minimum, it must be indicated whether the index is assumed to be 0- or 1-based. Then, I suppose it should be clearly indicated that its entities are going to be re-sorted regularly (this would be a hint to use data structures with fast random access rather than sequences in implementation of descendants). Even description of template arguments T and N is very vague. If I get it right, T is data type to be used for each coordinate (either double or float), and N is dimension of the space (must be either 2 or 3). The same applies to most of the classes in BVH.
- there is no sense in maintaining myEntityIdxs sequence, it does not bring anything apart of extra indirection. To sort the objects, you can instead swap them directly in their own container, so that index is always direct.
- vector can be used instead of sequence or deque. When removing element from the set, for efficiency it can be first swapped with the last one, then the last removed
- in Swap(), use std::swap()
- class BVH_Set lacks documentation: at a minimum, it must be indicated whether the index is assumed to be 0- or 1-based. Then, I suppose it should be clearly indicated that its entities are going to be re-sorted regularly (this would be a hint to use data structures with fast random access rather than sequences in implementation of descendants). Even description of template arguments T and N is very vague. If I get it right, T is data type to be used for each coordinate (either double or float), and N is dimension of the space (must be either 2 or 3). The same applies to most of the classes in BVH.
Branch [archived branch] has been created by Participant.
[revision removed]
Detailed log of new commits:
Author: vpa
Date: Tue Apr 28 01:56:35 2015 +0300
Refactoring of SelectMgr_SensitiveEntitySet
[revision removed]
Detailed log of new commits:
Author: vpa
Date: Tue Apr 28 01:56:35 2015 +0300
Refactoring of SelectMgr_SensitiveEntitySet
Branch [archived branch] has been updated by Participant.
[revision removed]
Detailed log of new commits:
Author: vpa
Date: Wed May 6 20:49:42 2015 +0300
Fixed warnings
[revision removed]
Detailed log of new commits:
Author: vpa
Date: Wed May 6 20:49:42 2015 +0300
Fixed warnings
Branch [archived branch] has been updated by Participant.
[revision removed]
Detailed log of new commits:
Author: vpa
Date: Wed May 6 21:18:43 2015 +0300
Test case for issue #0026139
[revision removed]
Detailed log of new commits:
Author: vpa
Date: Wed May 6 21:18:43 2015 +0300
Test case for issue #0026139
Branch [archived branch] has been created by Participant.
[revision removed]
Detailed log of new commits:
Author: vpa
Date: Wed May 6 21:19:35 2015 +0300
0026139: AIS_InteractiveContext::Display performance regression
NCollection_Sequence in SelectMgr_SensitiveEntitySet was replaced by data map and vector to provide fast access for BVH
[revision removed]
Detailed log of new commits:
Author: vpa
Date: Wed May 6 21:19:35 2015 +0300
0026139: AIS_InteractiveContext::Display performance regression
NCollection_Sequence in SelectMgr_SensitiveEntitySet was replaced by data map and vector to provide fast access for BVH
Dear Anton,
please review patch from branch CR26139_2.
please review patch from branch CR26139_2.
Dear Mikhail,
Reviewed. Please test.
Reviewed. Please test.
Branch [archived branch] has been updated by Participant.
[revision removed]
Detailed log of new commits:
Author: abv
Date: Thu May 7 10:23:53 2015 +0300
Minor correction
[revision removed]
Detailed log of new commits:
Author: abv
Date: Thu May 7 10:23:53 2015 +0300
Minor correction
Correction pushed to CR26139_2, please re-test
Dear Varvara,
There are a lot of regressions detected on Linux during testing of CR26139. Full report will be posted after testing on Windows.
More information about testing on Linux could be found by the following link:
http://occt-tests/CR26139-2-master-occt-64/Debian60-64/summary.html
There are a lot of regressions detected on Linux during testing of CR26139. Full report will be posted after testing on Windows.
More information about testing on Linux could be found by the following link:
http://occt-tests/CR26139-2-master-occt-64/Debian60-64/summary.html
Branch [archived branch] has been updated by Participant.
[revision removed]
Detailed log of new commits:
Author: vpa
Date: Thu May 7 18:36:16 2015 +0300
Corrections
[revision removed]
Detailed log of new commits:
Author: vpa
Date: Thu May 7 18:36:16 2015 +0300
Corrections
Branch [archived branch] has been created by Participant.
[revision removed]
Detailed log of new commits:
Author: vpa
Date: Thu May 7 18:39:36 2015 +0300
0026139: AIS_InteractiveContext::Display performance regression
NCollection_Sequence in SelectMgr_SensitiveEntitySet was replaced by indexed data map
[revision removed]
Detailed log of new commits:
Author: vpa
Date: Thu May 7 18:39:36 2015 +0300
0026139: AIS_InteractiveContext::Display performance regression
NCollection_Sequence in SelectMgr_SensitiveEntitySet was replaced by indexed data map
Add Draw test with stl model (send model to Sergey ANIKIN, because model is cannot be attached to the tracker). I've provided Amplifier screen shots with and without std::deque usage.
Occ release with deb info (last git):
Draw[4]> pload ALL
vinit
chrono
meshfromstl mesh [user path removed]/RL_Extern_NXSpeedBoat.stl
1
Draw[5]> Driver1/Viewer1/View1
Draw[6]> Chronometers activated.
Draw[7]> Nodes : 117256
Elements : 235534
Construction is finished
Reading OK...
Data source is created successful
MeshVS_Mesh is created successful
Elapsed time: 0 Hours 1 Minutes 0.053043 Seconds
CPU user time: 59.64 seconds
CPU system time: 0.14 seconds
Draw[8]>
Elapsed time: 0 Hours 0 Minutes 5.69999999982e-05 Seconds
Occ release with deb info (last git + std::deque usage):
Draw[4]> pload ALL
vinit
chrono
meshfromstl mesh [user path removed]/RL_Extern_NXSpeedBoat.stl1
Draw[5]> Driver1/Viewer1/View1
Draw[6]> Chronometers activated.
Draw[7]>
Nodes : 117256
Elements : 235534
Construction is finished
Reading OK...
Data source is created successful
MeshVS_Mesh is created successful
Elapsed time: 0 Hours 0 Minutes 3.682833 Seconds
CPU user time: 3.52 seconds
CPU system time: 0.15 seconds
Draw[8]> 3D View - Driver1/Viewer1/View1 was deleted.
exit
Occ release with deb info (last git):
Draw[4]> pload ALL
vinit
chrono
meshfromstl mesh [user path removed]/RL_Extern_NXSpeedBoat.stl
1
Draw[5]> Driver1/Viewer1/View1
Draw[6]> Chronometers activated.
Draw[7]> Nodes : 117256
Elements : 235534
Construction is finished
Reading OK...
Data source is created successful
MeshVS_Mesh is created successful
Elapsed time: 0 Hours 1 Minutes 0.053043 Seconds
CPU user time: 59.64 seconds
CPU system time: 0.14 seconds
Draw[8]>
Elapsed time: 0 Hours 0 Minutes 5.69999999982e-05 Seconds
Occ release with deb info (last git + std::deque usage):
Draw[4]> pload ALL
vinit
chrono
meshfromstl mesh [user path removed]/RL_Extern_NXSpeedBoat.stl1
Draw[5]> Driver1/Viewer1/View1
Draw[6]> Chronometers activated.
Draw[7]>
Nodes : 117256
Elements : 235534
Construction is finished
Reading OK...
Data source is created successful
MeshVS_Mesh is created successful
Elapsed time: 0 Hours 0 Minutes 3.682833 Seconds
CPU user time: 3.52 seconds
CPU system time: 0.15 seconds
Draw[8]> 3D View - Driver1/Viewer1/View1 was deleted.
exit
Hello, I've found Ncollection_BaseSequence is also bottleneck in OpenGl_BHVClipPrimitives. It became important when big models was displayed. See Attachment 2 (PNG).
Branch [archived branch] has been created by Author.
[revision removed]
Detailed log of new commits:
Author: Sergey Solomin
Date: Fri May 8 13:36:13 2015 +0300
0026139: AIS_InteractiveContext::Display performance regression
Replacing NCollection_BaseSequence with std::deque
[revision removed]
Detailed log of new commits:
Author: Sergey Solomin
Date: Fri May 8 13:36:13 2015 +0300
0026139: AIS_InteractiveContext::Display performance regression
Replacing NCollection_BaseSequence with std::deque
Branch [archived branch] has been deleted by Author.
[revision removed]
[revision removed]
Dear Author,
please take a look at patch in branch CR26139_3, where NCollection_Sequence was replaced by NCollecion_IndexedMap. That change allowed to reduce display time up to 2.5 times and remove time up to 270 times (in comparison to OCCT v6.9.0 beta2). Note that dequeue solution you proposed requires iteration through collection to remove elements, meanwhile indexed map allows to do it in constant time.
Regarding to performance of OpenGl_BHVClipPrimitives, the bug will be fixed within issue #0026199. Thanks for your contribution! :)
please take a look at patch in branch CR26139_3, where NCollection_Sequence was replaced by NCollecion_IndexedMap. That change allowed to reduce display time up to 2.5 times and remove time up to 270 times (in comparison to OCCT v6.9.0 beta2). Note that dequeue solution you proposed requires iteration through collection to remove elements, meanwhile indexed map allows to do it in constant time.
Regarding to performance of OpenGl_BHVClipPrimitives, the bug will be fixed within issue #0026199. Thanks for your contribution! :)
Branch [archived branch] has been deleted by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been deleted by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been deleted by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been deleted by Participant.
[revision removed]
[revision removed]
Related records
- #0024623 · related to · closedVisualization - improve selection mechanism
- #0026199 · related to · closedVisualization - use NCollection_IndexedMap instead of NCollection_Sequence in OpenGl_BVHClipPrimitiveSet to improve performance
- #0026195 · related to · closedVisualization - optimize selection algorithms
- #0026626 · related to · closedocc 6.9.0 performance loss
- #0033496 · related to · newTests - Removing not-relevant performance test