MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0022901Open CASCADE[OCCT] OCCT:VISpublic2012-01-12 18:562014-11-11 12:58
Reportersan 
Assigned Tobugmaster 
PriorityhighSeveritymajor 
StatusclosedResolutionfixed 
PlatformAOSLOS VersionL
Product Version 
Target Version[OCCT] 6.8.0Fixed in Version[OCCT] 6.8.0 
Summary0022901: Low performance of IVtkTools_DisplayModeFilter
DescriptionHighlighting detected sub-shapes or the whole shape takes too long even on middle-size BREP shapes (like standard Bottom.brep).

The main reason is that vtkExtractSelection class used to extract VTK cells for sub-shapes of necessary types internally uses the quick sort algorithm that tends to become "square-n" slow on arrays containing a lot of identical values (see http://en.wikipedia.org/wiki/Quicksort#Formal_analysis [^]). And this is exactly the case for the array of sub-shape types.

The idea is to re-write IVtkTools_DisplayModeFilter filter without using vtkExtractSelection, simply checking sub-shape types for all input cells against the set of requested output sub-shape types.
TagsNo tags attached.
Test case numberNot needed
Attached Files

- Relationships
related to 0024904closedbugmaster Visualization - Integration of VIS component 

-  Notes
(0019177)
san (developer)
2012-01-19 09:41

After proposed correction, IVtkTools_DisplayModeFilter filter seems to work quite well.
However, there is some other performance bottleneck that results in low performance of (un-)highlighting in shell and compound selection modes.
It is not clear if IVtkTools_DisplayModeFilter has some relation to this problem or not, thus I suggest this issue remains assigned until this final performance problem is fixed.
(0019288)
rkv (developer)
2012-01-27 17:07
edited on: 2012-01-27 17:09

Replacement of NCollection_Set by NCollection_DataMap gives good results due to hash function usage when searching ids in collection in the cycle in IVtkTools_SubPolyDataFilter.RequestData(). Tests have been performed on "bottom.brep" shape in wireframe mode for preselection of a shell.

Time for the cycle:
Before fix: 2.37804 sec
 After fix: 0.0073996 sec


Detailed test report:
================================================================
Before fix (NCollection_Set.contains() is used in the cycle in SubPolyDataFilter)

onCursorMove {
  IVtkTools_ShapePicker::Pick: 0:1.22262
  IVtkTools_ShapePicker::GetPickedActors: 0:0.0296513 {
    including IVtkTools_ShapePicker::GetPickedShapesIds: 0:7.32928e-006
  }
  IVtkTools_ShapePicker::GetPickedSubShapesIds: 0:7.21507e-006
  
  IVtkOCCImpl_Shape->GetSubIds(id): 0:0.00686373
}
onCursorMove: total before rendering: 0:1.38402

+

onCursorMove:Render {
IVtkTools_SubPolyDataFilter (07D96880): RequestData: SUBSHAPE_IDS {
 including cycle:
    if (!myIdsSet.IsEmpty()) {
      for (vtkIdType i = 0; i < size; i++) {
        if (myIdsSet.Contains (aDataArray->GetValue(i))) {
          // Add a cell id to output if it's value is in the set.
          idList->InsertNextId(i);
        }
      }
    }
  IVtkTools_SubPolyDataFilter (07D96880): cycle: 0:2.37804
}
IVtkTools_SubPolyDataFilter (07D96880): total RequestData: 0:2.44854

IVtkTools_DisplayModeFilter (07D5BC90): RequestData
IVtkTools_DisplayModeFilter (07D5BC90): >IVtkTools_SubPolyDataFilter::RequestData: MESH_TYPES
IVtkTools_DisplayModeFilter (07D5BC90): total: 0:0.0633536 (including cycle: 0:0.0362115)
}
onCursorMove:Render: 0:2.70357

Total onCursorMove when select shell: ~ 4 sec
=========================================================================

After fix (NCollection_DataMap.IsBound() is used in the cycle in SubPolyDataFilter)

onCursorMove {
  IVtkTools_ShapePicker::Pick: 0:1.00375
  IVtkTools_ShapePicker::GetPickedActors: 0:0.0307559 {
    including IVtkTools_ShapePicker::GetPickedShapesIds: 0:7.3954e-006
  }
  IVtkTools_ShapePicker::GetPickedSubShapesIds: 0:9.59088e-006
  
  IVtkOCCImpl_Shape->GetSubIds(id): 0:0.00687927
}
onCursorMove: total before rendering: 0:1.15084

+

IVtkTools_SubPolyDataFilter (07D7D5C8): RequestData: SUBSHAPE_IDS {
  IVtkTools_SubPolyDataFilter (07D7D5C8): cycle: 0:0.0073996
}
IVtkTools_SubPolyDataFilter (07D7D5C8): total RequestData: 0:0.0765959

IVtkTools_DisplayModeFilter (07D5BCA0): RequestData
IVtkTools_DisplayModeFilter (07D5BCA0): >IVtkTools_SubPolyDataFilter::RequestData: MESH_TYPES
IVtkTools_DisplayModeFilter (07D5BCA0): total: 0:0.0300265 (including cycle: 0:0.00480859)
}
onCursorMove:Render: 0:0.295352

Total onCursorMove when select shell: ~ 1.4 sec

(0019295)
rkv (developer)
2012-01-27 18:49

There is a possibility to use std::unordered_set instead of NCollection_DataMap.
We would avoid extra parameters which are necessary in the case of working with DataMap.
What is your opinion?
(0019356)
san (developer)
2012-02-02 13:54

Why hot use NCollection_Map class declared in NCollection_Map.hxx?
(0021298)
san (developer)
2012-08-21 14:42
edited on: 2012-08-21 15:16

Corrected by patch for 0022877 (see branch CR22877).

(0021299)
san (developer)
2012-08-21 15:14

The issue was created during development of VIS component for development needs only.
The issue has been corrected and should be closed, no testing is required.

- Issue History
Date Modified Username Field Change
2012-01-12 18:56 san New Issue
2012-01-12 18:56 san Assigned To => rkv
2012-01-12 18:56 san Status new => assigned
2012-01-12 19:02 san Description Updated View Revisions
2012-01-19 09:41 san Note Added: 0019177
2012-01-27 17:07 rkv Note Added: 0019288
2012-01-27 17:09 rkv Note Edited: 0019288 View Revisions
2012-01-27 18:49 rkv Note Added: 0019295
2012-01-27 18:49 rkv Assigned To rkv => san
2012-01-27 18:49 rkv Status assigned => feedback
2012-02-02 13:54 san Note Added: 0019356
2012-02-02 13:54 san Status feedback => assigned
2012-08-21 14:42 san Note Added: 0021298
2012-08-21 14:42 san Status assigned => resolved
2012-08-21 15:14 san Note Added: 0021299
2012-08-21 15:14 san Assigned To san => bugmaster
2012-08-21 15:14 san Status resolved => reviewed
2012-08-21 15:16 san Note Edited: 0021298 View Revisions
2014-09-18 09:50 abv Target Version => 6.8.0
2014-09-18 09:58 abv Category PRODUCTS:VIS => OCCT:VIS
2014-09-18 10:39 bugmaster Project Internal => Open CASCADE
2014-09-22 11:58 apn Test case number => Not needed
2014-09-22 11:58 apn Assigned To bugmaster => san
2014-09-22 11:58 apn Status reviewed => closed
2014-09-22 11:58 apn Resolution open => fixed
2014-09-22 13:40 apn Assigned To san => bugmaster
2014-09-22 13:40 apn Status closed => feedback
2014-09-22 13:41 apn Status feedback => tested
2014-09-22 13:41 apn Status tested => verified
2014-09-22 13:41 apn Relationship added related to 0024904
2014-11-11 12:45 aiv Fixed in Version => 6.8.0
2014-11-11 12:58 aiv Status verified => closed


Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker