1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +03:00

0022653: Bad performance of Open CASCADE libraries that are used by Partition Algorithm Devekoped by : PKV

This commit is contained in:
bugmaster
2011-08-17 08:30:24 +00:00
committed by bugmaster
parent 9dfd728754
commit cf8e963aff
6 changed files with 202 additions and 106 deletions

View File

@@ -191,5 +191,16 @@ is
---C++: return &
raises NoSuchObject from Standard
is static;
--modified by NIZNHY-PKV Tue Jul 05 09:57:10 2011f
Find1(me; K : TheKey)
returns Address from Standard;
---Purpose: Returns the address of Item of the key <K>
-- or NULL if K is not in the map.
ChangeFind1(me:out; K : TheKey)
returns Address from Standard;
---Purpose: Returns the address of Item of the key <K>
-- or NULL if K is not in the map.
--modified by NIZNHY-PKV Tue Jul 05 09:57:14 2011t
end DataMap;

View File

@@ -137,24 +137,6 @@ Standard_Boolean TCollection_DataMap::Bind(const TheKey& K, const TheItem& I)
return Standard_True;
}
//=======================================================================
//function : Contains
//purpose :
//=======================================================================
Standard_Boolean TCollection_DataMap::IsBound(const TheKey& K) const
{
if (IsEmpty()) return Standard_False;
TCollection_DataMapNode** data = (TCollection_DataMapNode**) myData1;
TCollection_DataMapNode* p = data[Hasher::HashCode(K,NbBuckets())];
while (p) {
if (Hasher::IsEqual(p->Key(),K)) {
return Standard_True;
}
p = (TCollection_DataMapNode*) p->Next();
}
return Standard_False;
}
//=======================================================================
//function : Remove
@@ -181,12 +163,27 @@ Standard_Boolean TCollection_DataMap::UnBind(const TheKey& K)
}
return Standard_False;
}
//=======================================================================
//function : IsBound
//purpose :
//=======================================================================
Standard_Boolean TCollection_DataMap::IsBound(const TheKey& K) const
{
if (IsEmpty()) return Standard_False;
TCollection_DataMapNode** data = (TCollection_DataMapNode**) myData1;
TCollection_DataMapNode* p = data[Hasher::HashCode(K,NbBuckets())];
while (p) {
if (Hasher::IsEqual(p->Key(),K)) {
return Standard_True;
}
p = (TCollection_DataMapNode*) p->Next();
}
return Standard_False;
}
//=======================================================================
//function : Find
//purpose :
//=======================================================================
const TheItem& TCollection_DataMap::Find(const TheKey& K) const
{
Standard_NoSuchObject_Raise_if(IsEmpty(),"TCollection_DataMap::Find");
@@ -201,12 +198,10 @@ const TheItem& TCollection_DataMap::Find(const TheKey& K) const
Standard_NoSuchObject::Raise("TCollection_DataMap::Find");
return p->Value();
}
//=======================================================================
//function : ChangeFind
//purpose :
//=======================================================================
TheItem& TCollection_DataMap::ChangeFind(const TheKey& K)
{
Standard_NoSuchObject_Raise_if(IsEmpty(),"TCollection_DataMap::ChangeFind");
@@ -221,7 +216,36 @@ TheItem& TCollection_DataMap::ChangeFind(const TheKey& K)
Standard_NoSuchObject::Raise("TCollection_DataMap::ChangeFind");
return p->Value();
}
//modified by NIZNHY-PKV Tue Jul 05 09:54:14 2011f
//=======================================================================
//function : Find1
//purpose :
//=======================================================================
Standard_Address TCollection_DataMap::Find1(const TheKey& K) const
{
TCollection_DataMap *pMap=(TCollection_DataMap *)this;
return pMap->ChangeFind1(K);
}
//=======================================================================
//function : ChangeFind1
//purpose :
//=======================================================================
Standard_Address TCollection_DataMap::ChangeFind1(const TheKey& K)
{
if (IsEmpty()) {
return NULL;
}
TCollection_DataMapNode** data = (TCollection_DataMapNode**) myData1;
TCollection_DataMapNode* p = data[Hasher::HashCode(K,NbBuckets())];
while (p) {
if (Hasher::IsEqual(p->Key(),K)) {
return (Standard_Address)&p->Value();
}
p = (TCollection_DataMapNode*) p->Next();
}
return NULL;
}
//modified by NIZNHY-PKV Tue Jul 05 09:54:18 2011t

View File

@@ -203,6 +203,17 @@ is
-- Trigger: Raises NoSuchObject if K is not in the map.
raises NoSuchObject from Standard
---C++: return &
is static;
is static;
--modified by NIZNHY-PKV Tue Jul 05 08:38:26 2011f
FindFromKey1(me; K : TheKey)
returns Address from Standard;
---Purpose: Returns the address of Item of the key <K>
-- or NULL if K is not in the map.
ChangeFromKey1(me:out; K : TheKey)
returns Address from Standard;
---Purpose: Returns the address of Item of the key <K>
-- or NULL if K is not in the map.
--modified by NIZNHY-PKV Tue Jul 05 08:38:26 2011t
end IndexedDataMap;

View File

@@ -242,24 +242,6 @@ void TCollection_IndexedDataMap::RemoveLast()
delete p;
}
//=======================================================================
//function : Contains
//purpose :
//=======================================================================
Standard_Boolean TCollection_IndexedDataMap::Contains(const TheKey& K1) const
{
if (IsEmpty()) return Standard_False;
TCollection_IndexedDataMapNode** data1 = (TCollection_IndexedDataMapNode**)myData1;
Standard_Integer k1 = Hasher::HashCode(K1,NbBuckets());
TCollection_IndexedDataMapNode *p1;
p1 = data1[k1];
while (p1) {
if (Hasher::IsEqual(p1->Key1(),K1)) return Standard_True;
p1 = (TCollection_IndexedDataMapNode*) p1->Next();
}
return Standard_False;
}
//=======================================================================
//function : FindKey
@@ -340,12 +322,27 @@ Standard_Integer TCollection_IndexedDataMap::FindIndex(const TheKey& K1) const
}
return 0;
}
//=======================================================================
//function : Contains
//purpose :
//=======================================================================
Standard_Boolean TCollection_IndexedDataMap::Contains(const TheKey& K1) const
{
if (IsEmpty()) return Standard_False;
TCollection_IndexedDataMapNode** data1 = (TCollection_IndexedDataMapNode**)myData1;
Standard_Integer k1 = Hasher::HashCode(K1,NbBuckets());
TCollection_IndexedDataMapNode *p1;
p1 = data1[k1];
while (p1) {
if (Hasher::IsEqual(p1->Key1(),K1)) return Standard_True;
p1 = (TCollection_IndexedDataMapNode*) p1->Next();
}
return Standard_False;
}
//=======================================================================
//function : FindFromKey
//purpose :
//=======================================================================
const TheItem& TCollection_IndexedDataMap::FindFromKey(const TheKey& K1) const
{
Standard_OutOfRange_Raise_if(IsEmpty(),"TCollection_IndexedDataMap::FindFromKey");
@@ -360,12 +357,10 @@ const TheItem& TCollection_IndexedDataMap::FindFromKey(const TheKey& K1) const
Standard_OutOfRange::Raise("TCollection_IndexedDataMap::FindFromKey");
return p1->Value();
}
//=======================================================================
//function : ChangeFromKey
//purpose :
//=======================================================================
TheItem& TCollection_IndexedDataMap::ChangeFromKey(const TheKey& K1)
{
Standard_OutOfRange_Raise_if(IsEmpty(),"TCollection_IndexedDataMap::ChangeFromKey");
@@ -380,8 +375,37 @@ TheItem& TCollection_IndexedDataMap::ChangeFromKey(const TheKey& K1)
Standard_OutOfRange::Raise("TCollection_IndexedDataMap::ChangeFromKey");
return p1->Value();
}
//modified by NIZNHY-PKV Tue Jul 05 08:37:03 2011f
//=======================================================================
//function : FindFromKey1
//purpose :
//=======================================================================
Standard_Address TCollection_IndexedDataMap::FindFromKey1(const TheKey& K1) const
{
TCollection_IndexedDataMap *pMap=(TCollection_IndexedDataMap *)this;
return pMap->ChangeFromKey1(K1);
}
//=======================================================================
//function : ChangeFromKey1
//purpose :
//=======================================================================
Standard_Address TCollection_IndexedDataMap::ChangeFromKey1(const TheKey& K1)
{
if (IsEmpty()) {
return NULL;
}
TCollection_IndexedDataMapNode** data1 = (TCollection_IndexedDataMapNode**)myData1;
Standard_Integer k1 = Hasher::HashCode(K1,NbBuckets());
TCollection_IndexedDataMapNode *p1;
p1 = data1[k1];
while (p1) {
if (Hasher::IsEqual(p1->Key1(),K1)) {
return (Standard_Address)&p1->Value();
}
p1 = (TCollection_IndexedDataMapNode*) p1->Next();
}
return NULL;
}
// @@SDM: begin