mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-05-10 09:30:48 +08:00
Foundation Classes - math Container optimization (#717)
Increase DoubleTab container buffer size to 64 from 16. Optimize the vector initialisation with 5-10% increasing time. Before the creating was takes too much branching.
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
|
||||
class math_DoubleTab
|
||||
{
|
||||
static const Standard_Integer THE_BUFFER_SIZE = 16;
|
||||
static const Standard_Integer THE_BUFFER_SIZE = 64;
|
||||
|
||||
public:
|
||||
DEFINE_STANDARD_ALLOC;
|
||||
|
||||
@@ -22,10 +22,9 @@
|
||||
template <typename TheItemType>
|
||||
math_VectorBase<TheItemType>::math_VectorBase(const Standard_Integer theLower,
|
||||
const Standard_Integer theUpper)
|
||||
: Array(*myBuffer.data(),
|
||||
theLower,
|
||||
theUpper,
|
||||
(theUpper - theLower + 1 <= math_VectorBase::THE_BUFFER_SIZE))
|
||||
: Array(theUpper - theLower + 1 <= math_VectorBase::THE_BUFFER_SIZE
|
||||
? NCollection_Array1<TheItemType>(*myBuffer.data(), theLower, theUpper)
|
||||
: NCollection_Array1<TheItemType>(theLower, theUpper))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -33,10 +32,9 @@ template <typename TheItemType>
|
||||
math_VectorBase<TheItemType>::math_VectorBase(const Standard_Integer theLower,
|
||||
const Standard_Integer theUpper,
|
||||
const TheItemType theInitialValue)
|
||||
: Array(*myBuffer.data(),
|
||||
theLower,
|
||||
theUpper,
|
||||
(theUpper - theLower + 1 <= math_VectorBase::THE_BUFFER_SIZE))
|
||||
: Array(theUpper - theLower + 1 <= math_VectorBase::THE_BUFFER_SIZE
|
||||
? NCollection_Array1<TheItemType>(*myBuffer.data(), theLower, theUpper)
|
||||
: NCollection_Array1<TheItemType>(theLower, theUpper))
|
||||
{
|
||||
Array.Init(theInitialValue);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user