View Issue Details

IDProjectCategoryView StatusLast Update
0024042CommunityOCCT:Foundation Classespublic2013-12-19 13:56
ReporterRoman Lygin Assigned Toapn  
PrioritynormalSeverityintegration request 
Status closedResolutionfixed 
PlatformAOSL 
Product Version6.6.0 
Target Version6.7.0Fixed in Version6.7.0 
Summary0024042: Performance improvements: Foundation Classes
DescriptionA series of performance improvements, to help speed up surface-surface intersection. The set will be split into a few chunks to ease integration.

Key details:

* TCollection - more inlining
In TCollection_Array1::Init() replaced with [i] - better for compiler's vectorization and consistent with Array2::Init()

* NCollection_BaseCollection
- added Allocator() to return an allocator. STL-consistent and allows to reuse allocator

* Bnd_Box2d
- Removed redundant copy (what becomes a hotspot)
Steps To ReproduceN/A
TagsNo tags attached.
Test case numberNot needed

Relationships

related to 0024072 closedRoman Lygin Community VC9 64-bit compiler crashes while compiling IntPoly_ShapeSection.cxx 
related to 0024043 closedRoman Lygin Community Performance improvements: Modeling Algorithms 
related to 0024044 closedbugmaster Community Performance improvements: Foundation Classes (math) 
related to 0024071 closedabv Open CASCADE VC 2009 64-bit compiler crashes while compiling IntPoly_ShapeSection.cxx 

Activities

Roman Lygin

2013-06-25 19:13

developer   ~0024864

The fix pushed into the repository

abv

2013-06-26 06:52

manager   ~0024868

One remark: the code or array constructors / destructors which is made inline contain conditional compilation triggered by macro __OPTIM_ARRAY. I believe it is potentially dangerous: even if this macro is not defined in OCCT, what if some application code defines it? I propose removing the code activated by this macro completely.

Besides, if you have some numbers indicating how performance improved after this fix in your application, I encourage you to share these in a note to this issue -- it will help providing more sensible information of this fix in Release Notes.

Roman Lygin

2013-06-27 22:30

developer   ~0024906

Thanks Andrey. The code under __OPTIM_ARRAY has been removed (the branch repushed into the repository).

As for performance gains: I have been measuring cumulative effects of all changes done incrementally (in other related trackers - 0024043, 0024044). The CAD Exchanger code that invokes multiple intersection computations (which take about 80% of this code) speeds up by 20%-30% depending on workloads. That corresponds to ~25%-35% of the intersection code.
Of course, the effect differs per workloads, as different code branches get executed but this gives an approximation.

There are opportunities for greater speed up which would involve algorithm redesigns or other extensions (e.g. multiple computations of surface points at once instead of loop over poles). But this is currently beyond the scope of my effort.

abv

2013-06-28 15:47

manager   ~0024915

Reviewed, please test

mkv

2013-07-03 11:42

tester   ~0024951

Dear BugMaster,

Branch CR24042 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
SHA-1: db24b0959bce4a26d40b88b3e46d07f8495daa8e

Number of compiler warnings:

occt component :
Linux: 2 (2 on master)
Windows: 7 (7 on master)

products component :
Linux: 0 (0 on master)
Windows: 63 (63 on master)

Regressions:
No regressions

Improvements:
No improvements

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 365028944 / 366290416
Total CPU difference: 44231.47000000074 / 43406.39000000102

Testing on Windows:
Total MEMORY difference: 424202976 / 424097456
Total CPU difference: 40968.0625 / 44235.734375

There are not differences in images found by testdiff.

abv

2013-07-12 16:09

manager   ~0025053

This fix breaks compilation by MSVC++ 9.0 (MSVC 2008) in 64-bit mode, see http://dev.opencascade.org/index.php?q=node/781

Roman Lygin

2013-07-16 21:50

developer   ~0025089

Last edited: 2013-07-16 21:51

Fix for 0024072 partially rolls back modifications made in TCollection to be more conservative.
Note for the future: however, if some workloads demonstrate that inlining Array2 helps performance without inflating the code size then constructor/destructor can be inlined again.

barbier

2013-07-19 18:53

reporter   ~0025125

Reading figures above, it looks like performance is worse on Linux with this patch, isn't it?

Roman Lygin

2013-07-19 20:13

developer   ~0025126

Denis,
If you refer to the following excerpts:
Testing on Linux:
Total MEMORY difference: 365028944 / 366290416
Total CPU difference: 44231.47000000074 / 43406.39000000102

Testing on Windows:
Total MEMORY difference: 424202976 / 424097456
Total CPU difference: 40968.0625 / 44235.734375

then they cannot be currently trusted for fine-/medium-grain performance differences as the testing is executed on virtual machines, per OCC guys.

barbier

2013-07-19 23:58

reporter   ~0025127

Yes Roman, this is what I had in mind. Thanks for your explanations.

Related Changesets

occt: master 1145e2bc

2013-07-04 10:31:57

Roman Lygin

Details Diff
0024042: Performance improvements: Foundation Classes

Removed code under former __OPTIM_ARRAY macro
Affected Issues
0024042
mod - src/Bnd/Bnd_Box2d.cxx Diff File
mod - src/NCollection/NCollection_BaseCollection.hxx Diff File
mod - src/TCollection/TCollection_Array1.cdl Diff File
mod - src/TCollection/TCollection_Array1.gxx Diff File
mod - src/TCollection/TCollection_Array1.lxx Diff File
mod - src/TCollection/TCollection_Array2.cdl Diff File
mod - src/TCollection/TCollection_Array2.gxx Diff File
mod - src/TCollection/TCollection_Array2.lxx Diff File
mod - src/TCollection/TCollection_HArray1.cdl Diff File
mod - src/TCollection/TCollection_HArray1.gxx Diff File
mod - src/TCollection/TCollection_HArray1.lxx Diff File
mod - src/TCollection/TCollection_HArray2.cdl Diff File
mod - src/TCollection/TCollection_HArray2.gxx Diff File
mod - src/TCollection/TCollection_HArray2.lxx Diff File

Issue History

Date Modified Username Field Change
2013-06-25 19:08 Roman Lygin New Issue
2013-06-25 19:08 Roman Lygin Assigned To => abv
2013-06-25 19:13 Roman Lygin Note Added: 0024864
2013-06-25 19:13 Roman Lygin Status new => resolved
2013-06-25 21:26 Roman Lygin Relationship added related to 0024043
2013-06-25 22:00 Roman Lygin Relationship added related to 0024044
2013-06-26 06:52 abv Note Added: 0024868
2013-06-26 06:52 abv Assigned To abv => Roman Lygin
2013-06-26 06:52 abv Status resolved => assigned
2013-06-27 22:30 Roman Lygin Note Added: 0024906
2013-06-27 22:31 Roman Lygin Assigned To Roman Lygin => ifv
2013-06-27 22:31 Roman Lygin Status assigned => resolved
2013-06-27 22:32 Roman Lygin Assigned To ifv => abv
2013-06-28 15:47 abv Note Added: 0024915
2013-06-28 15:47 abv Assigned To abv => bugmaster
2013-06-28 15:47 abv Status resolved => reviewed
2013-07-01 15:42 mkv Assigned To bugmaster => mkv
2013-07-03 11:42 mkv Note Added: 0024951
2013-07-03 11:42 mkv Test case number => Not needed
2013-07-03 11:42 mkv Assigned To mkv => bugmaster
2013-07-03 11:42 mkv Status reviewed => tested
2013-07-03 11:44 apn Product Version => 6.6.0
2013-07-03 11:44 apn Target Version => 6.7.0
2013-07-05 11:57 Roman Lygin Changeset attached => occt master 1145e2bc
2013-07-05 11:57 Roman Lygin Assigned To bugmaster => Roman Lygin
2013-07-05 11:57 Roman Lygin Status tested => verified
2013-07-05 11:57 Roman Lygin Resolution open => fixed
2013-07-12 16:09 abv Note Added: 0025053
2013-07-12 16:09 abv Assigned To Roman Lygin => apn
2013-07-12 16:22 apn Relationship added related to 0024071
2013-07-12 16:36 apn Relationship added related to 0024072
2013-07-16 21:50 Roman Lygin Note Added: 0025089
2013-07-16 21:51 Roman Lygin Note Edited: 0025089
2013-07-19 18:53 barbier Note Added: 0025125
2013-07-19 20:13 Roman Lygin Note Added: 0025126
2013-07-19 23:58 barbier Note Added: 0025127
2013-12-19 13:52 bugmaster Status verified => closed
2013-12-19 13:56 bugmaster Fixed in Version => 6.7.0