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.
- static const Standard_Integer THE_BUFFER_SIZE = 16;
+ static const Standard_Integer THE_BUFFER_SIZE = 64;
public:
DEFINE_STANDARD_ALLOC;
public:
DEFINE_STANDARD_ALLOC;
template <typename TheItemType>
math_VectorBase<TheItemType>::math_VectorBase(const Standard_Integer theLower,
const Standard_Integer theUpper)
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))
math_VectorBase<TheItemType>::math_VectorBase(const Standard_Integer theLower,
const Standard_Integer theUpper,
const TheItemType theInitialValue)
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);
}
{
Array.Init(theInitialValue);
}