OCC22355 Avoid annoying warnings in NCollection_SparseArray.hxx on 64-bit Linux with...
[occt.git] / src / QANCollection / QANCollection_PerfSparseArray.hxx
1 // File:        QANCollection_PerfArrays.hxx
2 // Created:     Wed May 15 15:29:20 2002
3 // Author:      Alexander KARTOMIN (akm)
4 //              <a-kartomin@opencascade.com>
5
6
7 #ifndef QANCollection_PerfSparseArray_HeaderFile
8 #define QANCollection_PerfSparseArray_HeaderFile
9
10 #define PERF_ENABLE_METERS
11 #include <DebugTools.h>
12 ////////////////////////////////#include <Perf_Meter.hxx>
13 #include <NCollection_SparseArray.hxx>
14 #include <NCollection_SparseArrayBase.hxx>
15
16 // ===================== Test perform of SparseArray type ==========================
17 void CompSparseArray (const Standard_Integer theRep, const Standard_Integer theSize)
18 {
19   Standard_Integer i,j;
20   for (i=0; i<theRep; i++)
21     {
22       PERF_START_METER("NCollection_SparseArray creation")
23
24       NCollection_SparseArray<Standard_Integer> a1(theSize),a2(theSize);
25       
26       PERF_STOP_METER("NCollection_SparseArray creation")
27         
28       PERF_START_METER("NCollection_SparseArray filling")
29       for( j=0;j<theSize;j++ )
30       {
31         Standard_Integer iIndex;
32         Random(iIndex,theSize);
33         a1.SetValue(j,iIndex+1);
34       }
35       
36       PERF_STOP_METER("NCollection_SparseArray filling")
37       
38       PERF_START_METER("NCollection_SparseArray size")
39           Standard_Integer sizeSparseArray=a1.Size();
40       PERF_STOP_METER("NCollection_SparseArray size")
41       
42       PERF_START_METER("NCollection_Array1 Assign")
43         a2.Assign(a1);
44       PERF_STOP_METER("NCollection_Array1 Assign")
45       PERF_START_METER("NCollection_SparseArray HasValue")
46       for (j=0; j<theSize; j++)
47         {
48           Standard_Integer iIndex;
49           Random(iIndex,theSize);
50           a2.HasValue(iIndex+1);
51         }
52       PERF_STOP_METER("NCollection_SparseArray HasValue")
53       PERF_START_METER("NCollection_SparseArray UnsetValue")
54       for (j=0; j<theSize; j++)
55         {
56           Standard_Integer iIndex;
57           Random(iIndex,theSize);
58           a1.UnsetValue(iIndex+1);
59         }
60       PERF_STOP_METER("NCollection_SparseArray UnsetValue")
61       
62       PERF_START_METER("NCollection_SparseArray Clear")
63         a1.Clear();
64         a2.Clear();
65       PERF_STOP_METER("NCollection_SparseArray Clear")
66       
67     }
68
69   PERF_PRINT_ALL_METERS
70 }
71
72 #endif