View Issue Details

IDProjectCategoryView StatusLast Update
0030165Open CASCADEOCCT:Foundation Classespublic2021-09-03 13:40
Reporterkgv Assigned Tobugmaster  
PrioritynormalSeverityfeature 
Status closedResolutionfixed 
Target Version7.4.0 
Summary0030165: Foundation Classes, TColStd_PackedMapOfInteger - provide flag for pre-allocating map of fixed size
DescriptionCurrently TColStd_PackedMapOfInteger behaves like a normal map - it dynamically resized the array of buckets and re-allocates each bucket after clearing the map.

In some scenarios memory allocation might be a performance bottleneck, so that alternative approach might be considered - preserving map size with pessimistic scenario (number of buckets each to maximum integer key in the map, so that HashCode() would not truncate value).
TagsNo tags attached.
Test case number

Attached Files

  • 0001-0030165-Foundation-Classes-TColStd_PackedMapOfIntege.patch (69,511 bytes)
  • 0002-TColStd_PackedMapOfInteger-SparseAllocation-added-ne.patch (29,695 bytes)

Relationships

related to 0029642 closedbugmaster Open CASCADE Foundation Classes - deprecate TCollection classes except strings 
related to 0031943 closedbugmaster Open CASCADE Foundation Classes, TColStd_PackedMapOfInteger - get rid of TCollection_BasicMap 

Activities

git

2018-09-26 22:59

administrator   ~0079422

Branch CR30165 has been created by kgv.

SHA-1: 979f4e631ce1c8c8f7a3bfc057028dc284c98a76


Detailed log of new commits:

Author: kgv
Date: Wed Sep 26 22:11:59 2018 +0300

    TColStd_PackedMapOfInteger::SparseAllocation() - added new flag managing memory allocation scheme between map style and array style.

Author: kgv
Date: Wed Sep 26 17:10:30 2018 +0300

    0030165: Foundation Classes, TColStd_PackedMapOfInteger - provide flag for pre-allocating map of fixed size
    
    TCollection_BasicMap has been merged into TColStd_PackedMapOfInteger.
    TColStd_PackedMapOfInteger has been cleaned up from unsafe type casts.

abv

2018-10-02 15:18

manager   ~0079601

Does it help in some known scenario?

kgv

2018-10-02 15:36

developer   ~0079605

This option gives only up to ~ 15% performance boost within my local tests.
So that TColStd_BitField is expected to be better for extreme performance improvement, but this should be checked considering real bottlenecks in the whole process.

On AIS_PointCloud:
pload MODELING VISUALIZATION
restore dem.brep d
tcopy -mesh d d2
compound d d2 c
trinfo c
vclear
vinit View1
vpointcloud p c
vfit
vzoom 0.5
chrono t reset; chrono t start
vselmode p 1 1
chrono t stop; chrono t show


chrono t reset; chrono t start
vmoveto 250 250
chrono t stop; chrono t show

vselect 0 0
chrono t reset; chrono t start
vselect 10 10 400 400
chrono t stop; chrono t show

vselect 0 0
chrono t reset; chrono t start
vselect 100 100 250 250
chrono t stop; chrono t show


Results for rectangular selection
(includes time for highlighting selected points):
This shape contains 21807496 triangles.
                    10916172 nodes.

OLD map:
Elapsed time: 0 Hours 0 Minutes 0.934069483563 Seconds
NEW map:
Elapsed time: 0 Hours 0 Minutes 0.834714741781 Seconds
OLD map parallel:
Elapsed time: 0 Hours 0 Minutes 0.709464338026 Seconds
NEW map parallel:
Elapsed time: 0 Hours 0 Minutes 0.676648563385 Seconds

kgv

2018-10-02 15:43

developer   ~0079606

The code clean up of TColStd_PackedMapOfInteger also gives a tiny boost: 0.966598009458 s -> 0.934069483563 s of rectangular points selection with highlighting.
In particular, current TColStd_PackedMapOfInteger implementation uses unneeded inheritance from Standard_Transient for map nodes.

kgv

2019-03-02 23:35

developer   ~0082537

Please close the issue.

git

2020-10-08 11:02

administrator   ~0095820

Branch CR30165 has been deleted by inv.

SHA-1: 979f4e631ce1c8c8f7a3bfc057028dc284c98a76

git

2020-11-16 22:17

administrator   ~0096802

Branch CR30165 has been created by kgv.

SHA-1: 979f4e631ce1c8c8f7a3bfc057028dc284c98a76


Detailed log of new commits:

Author: kgv
Date: Wed Sep 26 22:11:59 2018 +0300

    TColStd_PackedMapOfInteger::SparseAllocation() - added new flag managing memory allocation scheme between map style and array style.

Author: kgv
Date: Wed Sep 26 17:10:30 2018 +0300

    0030165: Foundation Classes, TColStd_PackedMapOfInteger - provide flag for pre-allocating map of fixed size
    
    TCollection_BasicMap has been merged into TColStd_PackedMapOfInteger.
    TColStd_PackedMapOfInteger has been cleaned up from unsafe type casts.

kgv

2021-08-24 00:56

developer  

0001-0030165-Foundation-Classes-TColStd_PackedMapOfIntege.patch (69,511 bytes)

kgv

2021-08-24 00:56

developer  

0002-TColStd_PackedMapOfInteger-SparseAllocation-added-ne.patch (29,695 bytes)

git

2021-08-24 00:56

administrator   ~0103394

Branch CR30165 has been deleted by kgv.

SHA-1: 979f4e631ce1c8c8f7a3bfc057028dc284c98a76

kgv

2021-08-24 00:57

developer   ~0103395

Please close the bug.

Issue History

Date Modified Username Field Change
2018-09-26 20:44 kgv New Issue
2018-09-26 20:44 kgv Assigned To => abv
2018-09-26 22:59 git Note Added: 0079422
2018-10-02 15:18 abv Note Added: 0079601
2018-10-02 15:36 kgv Note Added: 0079605
2018-10-02 15:43 kgv Note Added: 0079606
2019-03-02 23:35 kgv Note Added: 0082537
2019-03-02 23:35 kgv Assigned To abv => bugmaster
2019-03-02 23:35 kgv Status new => feedback
2019-03-02 23:35 kgv Resolution open => won't fix
2019-03-05 10:12 bugmaster Status feedback => closed
2020-10-08 11:02 git Note Added: 0095820
2020-11-16 22:16 kgv Relationship added related to 0029642
2020-11-16 22:17 git Note Added: 0096802
2020-11-16 22:30 kgv Relationship added related to 0031943
2021-08-24 00:56 kgv Status closed => feedback
2021-08-24 00:56 kgv Resolution won't fix => reopened
2021-08-24 00:56 kgv File Added: 0001-0030165-Foundation-Classes-TColStd_PackedMapOfIntege.patch
2021-08-24 00:56 kgv File Added: 0002-TColStd_PackedMapOfInteger-SparseAllocation-added-ne.patch
2021-08-24 00:56 git Note Added: 0103394
2021-08-24 00:57 kgv Note Added: 0103395
2021-09-03 13:40 bugmaster Status feedback => closed
2021-09-03 13:40 bugmaster Resolution reopened => fixed