MantisBT - Community
View Issue Details
0022584Community[OCCT] OCCT:Meshpublic2011-06-07 19:272012-11-09 10:17
Roman Lygin 
[OCCT] 6.5.2[OCCT] 6.5.2 
no need for test case
0022584: Optimization of BRepMesh_DiscretFactory to cache registered factory methods
RLN contribution (RLN_fix370)
- Summary: Optimization of BRepMesh_DiscretFactory to cache registered factory
- Detailed description: In 6.3.1 any custom factory method (*::Discret()) is
loaded from dynamic library
        upon every call to mesher. This was extremely slow and made the
mechanism unusable.
        Now library is loaded only once and then its factory method is cached in
        - This requires adding an instance of DataMap<AsciiString,OSD_Function>.
To optimize it is added into
          OSD package and Draw and Plugin packages reuse it.
No tags attached.
related to 0022600closed bugmaster TBB has to be disabled in BRepMesh due to data races 
child of 0022825closed abv Integration of contributions by Roman Lygin to OCCT 6.5.2 
Issue History
2011-06-23 18:31kgvOtherBugsDependingOnThis => 22600
2011-07-05 18:11kgvCC => kgv
2011-08-02 11:31bugmasterCategoryOCCT:MOA => OCCT:Modeling Algorithms
2011-09-13 09:27abvTest case number => no need for test case
2011-09-13 09:27abvStatusacknowledged => verified
2011-09-13 09:27abvFixed in VersionEMPTY =>
2011-09-13 09:27abvResolutionsuspended => fixed
2011-09-13 09:27abvAssigned Tobugmaster => kgv
2011-09-20 17:22szyTarget Version => 6.5.2
2011-09-20 17:22szyDescription Updatedbug_revision_view_page.php?rev_id=602#r602
2011-11-25 11:46szyDescription Updatedbug_revision_view_page.php?rev_id=1078#r1078
2011-12-05 11:22abvRelationship addedchild of 0022825
2012-01-17 18:37abvAssigned Tokgv => Roman Lygin
2012-11-09 10:17abvCategoryOCCT:Modeling Algorithms => OCCT:Mesh

2011-06-16 12:18   
While this patch introduce plugins functions caching (thus eliminates linkage
with plugin and retrieving function address on each call to the factory) it
doesn't resolve another serious issure with current factory architecture.

BRepMesh_DiscretFactory::Discret() returns private field myPDiscret of class
instance that intended to be global (BRepMesh_DiscretFactory&
BRepMesh_DiscretFactory::Get()). This makes factory absolutely unsafe for
calling from multiple threads. I think this major problem should be fixed
within this performance improvement.

Suggested solution to return handle instead of pointer within this method
(BRepMesh_PDiscretRoot could be redefined to be handle to avoid changes in
applications) and probably introduce mutex to ensure thread-safety on first
call when plugin changed.
2011-06-23 18:31   
Suggested improvements are implemented in OCC22600 BUG