0029830: STEPCAFControl_Reader poor performance - quadratic dependence

Various performance improvements in STEP read/write algorithms:
- Search for the  label of a shape or component shape is improved using map mechanism instead of brute force iteration.
- Invariant FindEntities() is moved out of the loop in the method getStyledItem in STEPCAFControl/STEPCAFControl_Writer.cxx.
- A pointer to the end of binders chain is added in Transfer_Binder class to speed up adding a binder to the chain.
- Small fixes are added  to eliminate excess copying of handles, calls of handle DownCasts and so on.

Stack overflow is removed during destruction of STEP model with long chains of Transfer_Binder.
It is possible to use the Draw commands ReadStep and WriteStep to read/write from the session without accessing the disk file (use '.' for the file name).

Performance test cases for STEP reading/writing have been added.
This commit is contained in:
msv
2018-06-01 14:38:39 +03:00
committed by bugmaster
parent 0a96e0bbc4
commit 63cdf48ec1
17 changed files with 349 additions and 185 deletions

View File

@@ -120,7 +120,11 @@ public:
//! Returns label of instance of an assembly component
//! corresponding to a given NAUO
Standard_EXPORT static TDF_Label FindInstance (const Handle(StepRepr_NextAssemblyUsageOccurrence)& NAUO, const Handle(XCAFDoc_ShapeTool)& STool, const STEPConstruct_Tool& Tool, const STEPCAFControl_DataMapOfPDExternFile& PDRFileMap, const XCAFDoc_DataMapOfShapeLabel& ShapeLabelMap);
Standard_EXPORT static TDF_Label FindInstance
(const Handle(StepRepr_NextAssemblyUsageOccurrence)& NAUO,
const Handle(XCAFDoc_ShapeTool)& STool,
const STEPConstruct_Tool& Tool,
const XCAFDoc_DataMapOfShapeLabel& ShapeLabelMap);
//! Set ColorMode for indicate read Colors or not.
Standard_EXPORT void SetColorMode (const Standard_Boolean colormode);
@@ -189,7 +193,10 @@ protected:
//! Reads style assignments from STEP model and sets
//! corresponding color assignments in the DECAF document
Standard_EXPORT Standard_Boolean ReadColors (const Handle(XSControl_WorkSession)& WS, Handle(TDocStd_Document)& doc, const STEPCAFControl_DataMapOfPDExternFile& PDFileMap, const XCAFDoc_DataMapOfShapeLabel& ShapeLabelMap) const;
Standard_EXPORT Standard_Boolean ReadColors
(const Handle(XSControl_WorkSession)& WS,
Handle(TDocStd_Document)& doc,
const XCAFDoc_DataMapOfShapeLabel& ShapeLabelMap) const;
//! Reads names of parts defined in the STEP model and
//! assigns them to corresponding labels in the DECAF document