mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0023850: TDataStd_ByteArray is too slow on storage on disk
Optimization of a byte-array for XML persistence (binary persistence is ok). A possible bug is corrected (size of an array is extended a little). Same improvement for storage of a TDataStd_TreeNode. Improvement of speed of storage of several Ocaf attributes in XML file format. Also, format of storage of a double value is extended to keep 17 digits after a decimal point (it was used only 15 digits before). Several draw-commands are added to manipulate the basic Ocaf attributes: BooleanArray BooleanList IntegerList RealList A test-script for OCAF document successfully saved and opened from disk in XML file format. + 1 is added to keep '\0' Removed several spaces in source files. PLib_LocalArray is renamed to NCollection_LocalArray and became a template. It is used as a local array for Standard_Character in XML OCAF drivers, and as a local array of Standard_Real in PLib package. Small correction of test case for this fix
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
PLib_ChangeDim.gxx
|
||||
PLib_JacobiPolynomial_0.hxx
|
||||
PLib_LocalArray.hxx
|
||||
PLib_CMPLRS.edl
|
||||
|
@@ -23,7 +23,7 @@
|
||||
// Modified: 19/02/1997 by JCT : EvalPoly2Var added
|
||||
|
||||
#include <PLib.ixx>
|
||||
#include <PLib_LocalArray.hxx>
|
||||
#include <NCollection_LocalArray.hxx>
|
||||
#include <math_Matrix.hxx>
|
||||
#include <math_Gauss.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
@@ -192,8 +192,8 @@ void PLib::RationalDerivative(const Standard_Integer Degree,
|
||||
Standard_Real *RationalArray = &RDers;
|
||||
Standard_Real Factor ;
|
||||
Standard_Integer ii, Index, OtherIndex, Index1, Index2, jj;
|
||||
PLib_LocalArray binomial_array;
|
||||
PLib_LocalArray derivative_storage;
|
||||
NCollection_LocalArray<Standard_Real> binomial_array;
|
||||
NCollection_LocalArray<Standard_Real> derivative_storage;
|
||||
if (Dimension == 3) {
|
||||
Standard_Integer DeRequest1 = DerivativeRequest + 1;
|
||||
Standard_Integer MinDegRequ = DerivativeRequest;
|
||||
@@ -412,8 +412,8 @@ void PLib::RationalDerivatives(const Standard_Integer DerivativeRequest,
|
||||
Standard_Integer ii, Index, Index1, Index2, jj;
|
||||
Standard_Integer DeRequest1 = DerivativeRequest + 1;
|
||||
|
||||
PLib_LocalArray binomial_array (DeRequest1);
|
||||
PLib_LocalArray derivative_storage;
|
||||
NCollection_LocalArray<Standard_Real> binomial_array (DeRequest1);
|
||||
NCollection_LocalArray<Standard_Real> derivative_storage;
|
||||
|
||||
for (ii = 0 ; ii < DeRequest1 ; ii++) {
|
||||
binomial_array[ii] = 1.0e0 ;
|
||||
@@ -1945,7 +1945,7 @@ PLib::EvalLagrange(const Standard_Real Parameter,
|
||||
if (local_request >= Degree) {
|
||||
local_request = Degree ;
|
||||
}
|
||||
PLib_LocalArray divided_differences_array ((Degree + 1) * Dimension);
|
||||
NCollection_LocalArray<Standard_Real> divided_differences_array ((Degree + 1) * Dimension);
|
||||
//
|
||||
// Build the divided differences array
|
||||
//
|
||||
@@ -2075,7 +2075,7 @@ Standard_Integer PLib::EvalCubicHermite
|
||||
if (local_request >= Degree) {
|
||||
local_request = Degree ;
|
||||
}
|
||||
PLib_LocalArray divided_differences_array ((Degree + 1) * Dimension);
|
||||
NCollection_LocalArray<Standard_Real> divided_differences_array ((Degree + 1) * Dimension);
|
||||
|
||||
for (ii = 0, jj = 0 ; ii < 2 ; ii++, jj+= 2) {
|
||||
ParametersArray[jj] =
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
#include <PLib_HermitJacobi.ixx>
|
||||
#include <PLib.hxx>
|
||||
#include <PLib_LocalArray.hxx>
|
||||
#include <NCollection_LocalArray.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
|
||||
//=======================================================================
|
||||
@@ -149,11 +149,11 @@ void PLib_HermitJacobi::D0123(const Standard_Integer NDeriv,
|
||||
TColStd_Array1OfReal& BasisD2,
|
||||
TColStd_Array1OfReal& BasisD3)
|
||||
{
|
||||
PLib_LocalArray jac0 (4 * 20);
|
||||
PLib_LocalArray jac1 (4 * 20);
|
||||
PLib_LocalArray jac2 (4 * 20);
|
||||
PLib_LocalArray jac3 (4 * 20);
|
||||
PLib_LocalArray wvalues (4);
|
||||
NCollection_LocalArray<Standard_Real> jac0 (4 * 20);
|
||||
NCollection_LocalArray<Standard_Real> jac1 (4 * 20);
|
||||
NCollection_LocalArray<Standard_Real> jac2 (4 * 20);
|
||||
NCollection_LocalArray<Standard_Real> jac3 (4 * 20);
|
||||
NCollection_LocalArray<Standard_Real> wvalues (4);
|
||||
|
||||
Standard_Integer i, j;
|
||||
Standard_Integer NivConstr = this->NivConstr(),
|
||||
|
@@ -1,83 +0,0 @@
|
||||
// Created on: 2009-09-23
|
||||
// Copyright (c) 2009-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
#ifndef _PLib_LocalArray_HeaderFile
|
||||
#define _PLib_LocalArray_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_TypeDef.hxx>
|
||||
|
||||
//! Auxiliary class optimizing creation of array buffer for
|
||||
//! evaluation of bspline (using stack allocation for small arrays)
|
||||
class PLib_LocalArray
|
||||
{
|
||||
public:
|
||||
|
||||
// 1K * sizeof (double) = 8K
|
||||
static const size_t MAX_ARRAY_SIZE = 1024;
|
||||
|
||||
PLib_LocalArray (const size_t theSize)
|
||||
: myPtr (myBuffer)
|
||||
{
|
||||
Allocate(theSize);
|
||||
}
|
||||
|
||||
PLib_LocalArray()
|
||||
: myPtr (myBuffer) {}
|
||||
|
||||
virtual ~PLib_LocalArray()
|
||||
{
|
||||
Deallocate();
|
||||
}
|
||||
|
||||
void Allocate (const size_t theSize)
|
||||
{
|
||||
Deallocate();
|
||||
if (theSize > MAX_ARRAY_SIZE)
|
||||
myPtr = (Standard_Real*)Standard::Allocate (theSize * sizeof(Standard_Real));
|
||||
else
|
||||
myPtr = myBuffer;
|
||||
}
|
||||
|
||||
operator Standard_Real*() const
|
||||
{
|
||||
return myPtr;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
PLib_LocalArray (const PLib_LocalArray& );
|
||||
PLib_LocalArray& operator= (const PLib_LocalArray& );
|
||||
|
||||
protected:
|
||||
|
||||
void Deallocate()
|
||||
{
|
||||
if (myPtr != myBuffer)
|
||||
Standard::Free (*(Standard_Address*)&myPtr);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
Standard_Real myBuffer[MAX_ARRAY_SIZE];
|
||||
Standard_Real* myPtr;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user