1 // Created on: 2002-05-15
2 // Created by: Alexander KARTOMIN (akm)
3 // Copyright (c) 2002-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef QANCollection_PerfSparseArray_HeaderFile
17 #define QANCollection_PerfSparseArray_HeaderFile
19 #define PERF_ENABLE_METERS
20 #include <OSD_PerfMeter.hxx>
21 ////////////////////////////////#include <Perf_Meter.hxx>
22 #include <NCollection_SparseArray.hxx>
23 #include <NCollection_SparseArrayBase.hxx>
25 // ===================== Test perform of SparseArray type ==========================
26 void CompSparseArray (const Standard_Integer theRep, const Standard_Integer theSize)
29 for (i=0; i<theRep; i++)
31 PERF_START_METER("NCollection_SparseArray creation")
33 NCollection_SparseArray<Standard_Integer> a1(theSize),a2(theSize);
35 PERF_STOP_METER("NCollection_SparseArray creation")
37 PERF_START_METER("NCollection_SparseArray filling")
38 for( j=0;j<theSize;j++ )
40 Standard_Integer iIndex;
41 Random(iIndex,theSize);
42 a1.SetValue(j,iIndex+1);
45 PERF_STOP_METER("NCollection_SparseArray filling")
47 PERF_START_METER("NCollection_SparseArray size")
48 Standard_Size sizeSparseArray=a1.Size();
49 (void)sizeSparseArray; // avoid compiler warning on unused variable
50 PERF_STOP_METER("NCollection_SparseArray size")
52 PERF_START_METER("NCollection_Array1 Assign")
54 PERF_STOP_METER("NCollection_Array1 Assign")
55 PERF_START_METER("NCollection_SparseArray HasValue")
56 for (j=0; j<theSize; j++)
58 Standard_Integer iIndex;
59 Random(iIndex,theSize);
60 a2.HasValue(iIndex+1);
62 PERF_STOP_METER("NCollection_SparseArray HasValue")
63 PERF_START_METER("NCollection_SparseArray UnsetValue")
64 for (j=0; j<theSize; j++)
66 Standard_Integer iIndex;
67 Random(iIndex,theSize);
68 a1.UnsetValue(iIndex+1);
70 PERF_STOP_METER("NCollection_SparseArray UnsetValue")
72 PERF_START_METER("NCollection_SparseArray Clear")
75 PERF_STOP_METER("NCollection_SparseArray Clear")