MantisBT
Mantis Bug Tracker Workflow

View Revisions: Issue #24859 All Revisions ] Back to Issue ]
Summary 0024859: Replace SortTools by STL equivalents
Revision 2014-04-18 17:16 by abv
Description Package SortTools implements several standard sort algorithms as generic classes. In context of effort to get rid of CDL (0024487), as well as for conversion of instances of TCollection classes to NCollection templates (0024750), it is desirable to convert these to normal C++ classes.

Actually we do not need to keep these algorithms in OCCT since these are provided by standard C++ library coming with all modern compilers. This replacement will be possible for NCollection classes as soon as improvement 0024831 is implemented. When TCollection classes are converted to templates, it will be easy to use STL algorithms in all cases.

Here is preliminary analysis of use of classes from SortTools:

1. StraightInsertionSort: has two instances in SortTools, used only for Reals in two places:
   - Adaptor3d_CurveOnSurface.cxx: this use is eliminated in context of 0024742
   - AppDef_Variational.cxx (on local array)

   It can be replaced by std::stable_sort()

2. ShellSort: has two instances in SortTools, used only for Reals in two places:
   - AppDef_Variational.cxx
   - BRepMesh_FastDiscretFace.cxx (on local array)


   It can be replaced by std::sort()

3. HeapSort: has two instances in SortTools (not used) and two instances in BRepMesh

   It can be replaced by either std::make_heap()/sort_heap() or by std::sort()

4. QuickSort: has several instaniations, used in ~ 10 places

   It can be replaced by std::sort()

It is desirable to check how performance is affected by switching to use of STL algorithms.
Revision 2014-04-18 17:14 by abv
Description Package SortTools implements several standard sort algorithms as generic classes. In context of effort to get rid of CDL (0024487), as well as for conversion of instances of TCollection classes to NCollection templates (0024750), it is desirable to convert these to normal C++ classes.

Actually we do not need to keep these algorithms in OCCT since these are provided by standard C++ library coming with all modern compilers. This replacement will be possible for NCollection classes as soon as improvement 0024813 is implemented. When TCollection classes are converted to templates, it will be easy to use STL algorithms in all cases.

Here is preliminary analysis of use of classes from SortTools:

1. StraightInsertionSort: has two instances in SortTools, used only for Reals in two places:
   - Adaptor3d_CurveOnSurface.cxx: this use is eliminated in context of 0024742
   - AppDef_Variational.cxx (on local array)

   It can be replaced by std::stable_sort()

2. ShellSort: has two instances in SortTools, used only for Reals in two places:
   - AppDef_Variational.cxx
   - BRepMesh_FastDiscretFace.cxx (on local array)


   It can be replaced by std::sort()

3. HeapSort: has two instances in SortTools (not used) and two instances in BRepMesh

   It can be replaced by either std::make_heap()/sort_heap() or by std::sort()

4. QuickSort: has several instaniations, used in ~10 places

   It can be replaced by std::sort()

It is desirable to check how performance is affected by switching to use of STL algorithms.


Copyright © 2000 - 2021 MantisBT Team
Powered by Mantis Bugtracker