Archived issue #0022584
Optimization of BRepMesh_DiscretFactory to cache registered factory methods
Description
RLN contribution (RLN_fix370)
- Summary: Optimization of BRepMesh_DiscretFactory to cache registered factory
methods
- 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
_DiscretFactory.
- 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.
- Summary: Optimization of BRepMesh_DiscretFactory to cache registered factory
methods
- 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
_DiscretFactory.
- 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.
Public activity
2 archived notes
Participants are labeled by their role within this record.
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.
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.
Suggested improvements are implemented in OCC22600 BUG
Related records