AIS_InteractiveContext::Display is slow in 6.9.0 beta


I've tested occt 6.9.0 beta and noticed that displaying AIS_IO now requires more time than earlier. Investigating this I detected that 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. NCollection_BaseSequence usage seems to be ineffective to store objects and indexes in SelectMgr_SensitiveEntitySet, because it has a lot of access operations.
What about replacing it with a container with fast elements access?

Some analysis pictures are bellow. I've chosen 1s interval when about 200 AIS_IO was displayed in cycle.
Bottom up view (NCollection_BaseSequence::Find is global hotspot).

Top down view

Solomin Sergey's picture

I've experimented replacing NCollection_BaseSequence with std::deque. The hotspot has gone and AIS_InteractiveContext::Display has sped up by 2.5x. (total time dropped from 2.5s to 1s). If you are interested in the fix I can report it via mantis.

Mikhail Sazonov's picture

Dear solomin_s,
Thank you for your input. This report is very valuable for us. Of course, it must be considered as a regression. Could you, please create a bug track issue for this bug?
Best regards,

Solomin Sergey's picture

Tracker has been created [#issue_26139].

Sergey Anikin's picture

Hello Sergey,

In order to ensure that our correction fixes exactly the issue you discovered, can you please provide a DRAW reproducer in issue 26139?
Or at least please describe the nature of AIS objects you used to reproduce the problem:
- Is it an AIS_Shape subclass?
- Does it override ComputeSelection() method?
- If it does, instances of which sensitive entity class does it create in the selection mode activated by default in your application - Select3D_SensitiveTriangulation, other standard sensitive entity class from Select3D package, a custom class - what is the base OCCT class then?

Thanks in advance for these details!

Best regards,

Andrey BETENEV's picture

Hello Sergey,

This problem should be fixed in OCCT 6.9.0 official release, could you please confirm this on your side?
Thank you in advance!


Vico's picture

I have reported another issue:, which might be have relation with this.

MFC smaples about the visulization is slow and sometimes, the screen will display nothing until the mouse move into the view. You can have a try to run sample Modeling "Evolved Blend" command, the final shape will disappear until your move mouse to the screen.