DiscussionsIssue archiveOCCT:Foundation Classes

Archived issue #0030165

Foundation Classes, TColStd_PackedMapOfInteger - provide flag for pre-allocating map of fixed size

Open CASCADEOCCT:Foundation Classesclosed9 public notes

Search issues

Description

Currently 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).

Public activity

9 archived notes

Participants are labeled by their role within this record.

01Commenter 2
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Author
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: Author
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 [archived branch]
    TColStd_PackedMapOfInteger has been cleaned up from unsafe type casts.
02Commenter 2
Does it help in some known scenario?
03Author
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
04Author
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.
05Author
Please close the issue.
06Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]
07Commenter 2
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Author
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: Author
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 [archived branch]
    TColStd_PackedMapOfInteger has been cleaned up from unsafe type casts.
08Commenter 2
Branch [archived branch] has been deleted by Author.

[revision removed]
09Author
Please close the bug.

Related records