1 // Created on: 2002-04-30
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_PerfMaps_HeaderFile
17 #define QANCollection_PerfMaps_HeaderFile
19 #include <TColStd_MapOfReal.hxx>
20 #include <TColStd_IndexedMapOfReal.hxx>
21 #include <QANCollection_DataMapOfRealPnt.hxx>
22 #include <QANCollection_DoubleMapOfRealInteger.hxx>
23 #include <QANCollection_IndexedDataMapOfRealPnt.hxx>
25 // ===================== Test perform of Map type ==========================
26 void CompMap (const Standard_Integer theRep,
27 const Standard_Integer theSize)
31 ////////////////////////////////Perf_Meter aNBind ("NCollection_Map adding",0);
32 ////////////////////////////////Perf_Meter aTBind ("TCollection_Map adding",0);
33 ////////////////////////////////Perf_Meter aNOper ("NCollection_Map operator=",0);
34 ////////////////////////////////Perf_Meter aTOper ("TCollection_Map operator=",0);
35 ////////////////////////////////Perf_Meter aNFind ("NCollection_Map finding",0);
36 ////////////////////////////////Perf_Meter aTFind ("TCollection_Map finding",0);
37 ////////////////////////////////Perf_Meter aNClea ("NCollection_Map clearing",0);
38 ////////////////////////////////Perf_Meter aTClea ("TCollection_Map clearing",0);
39 ////////////////////////////////Perf_Meter aNAssi ("NCollection_Map Assign",0);
40 for (i=0; i<theRep; i++)
42 ////////////////////////////////QANCollection_Map a1, a2;
43 QANCollection_MapPerf a1, a2;
44 ////////////////////////////////aNBind.Start();
45 PERF_START_METER("NCollection_Map adding")
46 for (j=1; j<=theSize; j++)
52 ////////////////////////////////aNBind.Stop();
53 PERF_STOP_METER("NCollection_Map adding")
54 ////////////////////////////////aNFind.Start();
55 PERF_START_METER("NCollection_Map finding")
56 for (j=1; j<=theSize; j++)
62 ////////////////////////////////aNFind.Stop();
63 PERF_STOP_METER("NCollection_Map finding")
64 ////////////////////////////////aNOper.Start();
65 PERF_START_METER("NCollection_Map operator=")
67 ////////////////////////////////aNOper.Stop();
68 PERF_STOP_METER("NCollection_Map operator=")
69 ////////////////////////////////aNAssi.Start();
70 PERF_START_METER("NCollection_Map Assign")
72 ////////////////////////////////aNAssi.Stop();
73 PERF_STOP_METER("NCollection_Map Assign")
74 ////////////////////////////////aNClea.Start();
75 PERF_START_METER("NCollection_Map clearing")
77 ////////////////////////////////aNClea.Stop();
78 PERF_STOP_METER("NCollection_Map clearing")
81 for (i=0; i<theRep; i++)
83 TColStd_MapOfReal a1, a2;
84 ////////////////////////////////aTBind.Start();
85 PERF_START_METER("TCollection_Map adding")
86 for (j=1; j<=theSize; j++)
92 ////////////////////////////////aTBind.Stop();
93 PERF_STOP_METER("TCollection_Map adding")
94 ////////////////////////////////aTFind.Start();
95 PERF_START_METER("TCollection_Map finding")
96 for (j=1; j<=theSize; j++)
102 ////////////////////////////////aTFind.Stop();
103 PERF_STOP_METER("TCollection_Map finding")
104 ////////////////////////////////aTOper.Start();
105 PERF_START_METER("TCollection_Map operator=")
107 ////////////////////////////////aTOper.Stop();
108 PERF_STOP_METER("TCollection_Map operator=")
109 ////////////////////////////////aTClea.Start();
110 PERF_START_METER("TCollection_Map clearing")
112 ////////////////////////////////aTClea.Stop();
113 PERF_STOP_METER("TCollection_Map clearing")
118 // ===================== Test perform of DataMap type ==========================
119 void CompDataMap (const Standard_Integer theRep,
120 const Standard_Integer theSize)
122 Standard_Integer i,j;
124 ////////////////////////////////Perf_Meter aNBind ("NCollection_DataMap binding",0);
125 ////////////////////////////////Perf_Meter aTBind ("TCollection_DataMap binding",0);
126 ////////////////////////////////Perf_Meter aNFind ("NCollection_DataMap finding",0);
127 ////////////////////////////////Perf_Meter aTFind ("TCollection_DataMap finding",0);
128 ////////////////////////////////Perf_Meter aNOper ("NCollection_DataMap operator=",0);
129 ////////////////////////////////Perf_Meter aTOper ("TCollection_DataMap operator=",0);
130 ////////////////////////////////Perf_Meter aNClea ("NCollection_DataMap clearing",0);
131 ////////////////////////////////Perf_Meter aTClea ("TCollection_DataMap clearing",0);
132 //////////////////////////////////Perf_Meter aNAssi ("NCollection_DataMap Assign",0);
133 for (i=0; i<theRep; i++)
135 ////////////////////////////////QANCollection_DataMap a1, a2;
136 QANCollection_DataMapPerf a1, a2;
137 ////////////////////////////////aNBind.Start();
138 PERF_START_METER("NCollection_DataMap binding")
139 for (j=1; j<=theSize; j++)
145 a1.Bind(aKey1,anItem);
147 ////////////////////////////////aNBind.Stop();
148 PERF_STOP_METER("NCollection_DataMap binding")
149 ////////////////////////////////aNFind.Start();
150 PERF_START_METER("NCollection_DataMap finding")
151 for (j=1; j<=theSize; j++)
157 ////////////////////////////////aNFind.Stop();
158 PERF_STOP_METER("NCollection_DataMap finding")
159 ////////////////////////////////aNOper.Start();
160 PERF_START_METER("NCollection_DataMap operator=")
162 ////////////////////////////////aNOper.Stop();
163 PERF_STOP_METER("NCollection_DataMap operator=")
167 ////////////////////////////////aNClea.Start();
168 PERF_START_METER("NCollection_DataMap clearing")
170 ////////////////////////////////aNClea.Stop();
171 PERF_STOP_METER("NCollection_DataMap clearing")
174 for (i=0; i<theRep; i++)
176 QANCollection_DataMapOfRealPnt a1, a2;
177 ////////////////////////////////aTBind.Start();
178 PERF_START_METER("TCollection_DataMap binding")
179 for (j=1; j<=theSize; j++)
185 a1.Bind(aKey1,anItem);
187 ////////////////////////////////aTBind.Stop();
188 PERF_STOP_METER("TCollection_DataMap binding")
189 ////////////////////////////////aTFind.Start();
190 PERF_START_METER("TCollection_DataMap finding")
191 for (j=1; j<=theSize; j++)
197 ////////////////////////////////aTFind.Stop();
198 PERF_STOP_METER("TCollection_DataMap finding")
199 ////////////////////////////////aTOper.Start();
200 PERF_START_METER("TCollection_DataMap operator=")
202 ////////////////////////////////aTOper.Stop();
203 PERF_STOP_METER("TCollection_DataMap operator=")
204 ////////////////////////////////aTClea.Start();
205 PERF_START_METER("TCollection_DataMap clearing")
207 ////////////////////////////////aTClea.Stop();
208 PERF_STOP_METER("TCollection_DataMap clearing")
213 // ===================== Test perform of DoubleMap type ==========================
214 void CompDoubleMap (const Standard_Integer theRep,
215 const Standard_Integer theSize)
217 Standard_Integer i,j;
218 Standard_Integer iFail1=0, iFail2=0;
220 ////////////////////////////////Perf_Meter aNBind ("NCollection_DoubleMap binding",0);
221 ////////////////////////////////Perf_Meter aTBind ("TCollection_DoubleMap binding",0);
222 ////////////////////////////////Perf_Meter aNFind ("NCollection_DoubleMap finding",0);
223 ////////////////////////////////Perf_Meter aTFind ("TCollection_DoubleMap finding",0);
224 ////////////////////////////////Perf_Meter aNOper ("NCollection_DoubleMap operator=",0);
225 ////////////////////////////////Perf_Meter aTOper ("TCollection_DoubleMap operator=",0);
226 ////////////////////////////////Perf_Meter aNClea ("NCollection_DoubleMap clearing",0);
227 ////////////////////////////////Perf_Meter aTClea ("TCollection_DoubleMap clearing",0);
228 //////////////////////////////////Perf_Meter aNAssi ("NCollection_DoubleMap Assign",0);
229 for (i=0; i<theRep; i++)
231 ////////////////////////////////QANCollection_DoubleMap a1, a2;
232 QANCollection_DoubleMapPerf a1, a2;
233 ////////////////////////////////aNBind.Start();
234 PERF_START_METER("NCollection_DoubleMap binding")
235 for (j=1; j<=theSize; j++)
244 while (a1.IsBound1(aKey1) || a1.IsBound2(aKey2));
246 a1.Bind(aKey1,aKey2);
248 ////////////////////////////////aNBind.Stop();
249 PERF_STOP_METER("NCollection_DoubleMap binding")
250 ////////////////////////////////aNFind.Start();
251 PERF_START_METER("NCollection_DoubleMap finding")
252 for (j=1; j<=theSize; j++)
258 a1.AreBound(aKey1,aKey2);
260 ////////////////////////////////aNFind.Stop();
261 PERF_STOP_METER("NCollection_DoubleMap finding")
262 ////////////////////////////////aNOper.Start();
263 PERF_START_METER("NCollection_DoubleMap operator=")
265 ////////////////////////////////aNOper.Stop();
266 PERF_STOP_METER("NCollection_DoubleMap operator=")
270 ////////////////////////////////aNClea.Start();
271 PERF_START_METER("NCollection_DoubleMap clearing")
273 ////////////////////////////////aNClea.Stop();
274 PERF_STOP_METER("NCollection_DoubleMap clearing")
277 for (i=0; i<theRep; i++)
279 QANCollection_DoubleMapOfRealInteger a1, a2;
280 ////////////////////////////////aTBind.Start();
281 PERF_START_METER("TCollection_DoubleMap binding")
282 for (j=1; j<=theSize; j++)
291 while (a1.IsBound1(aKey1) || a1.IsBound2(aKey2));
293 a1.Bind(aKey1,aKey2);
295 ////////////////////////////////aTBind.Stop();
296 PERF_STOP_METER("TCollection_DoubleMap binding")
297 ////////////////////////////////aTFind.Start();
298 PERF_START_METER("TCollection_DoubleMap finding")
299 for (j=1; j<=theSize; j++)
305 a1.AreBound(aKey1,aKey2);
307 ////////////////////////////////aTFind.Stop();
308 PERF_STOP_METER("TCollection_DoubleMap finding")
309 ////////////////////////////////aTOper.Start();
310 PERF_START_METER("TCollection_DoubleMap operator=")
312 ////////////////////////////////aTOper.Stop();
313 PERF_STOP_METER("TCollection_DoubleMap operator=")
314 ////////////////////////////////aTClea.Start();
315 PERF_START_METER("TCollection_DoubleMap clearing")
317 ////////////////////////////////aTClea.Stop();
318 PERF_STOP_METER("TCollection_DoubleMap clearing")
321 if (iFail1 || iFail2)
322 cout << "Warning : N map failed " << iFail1 << " times, T map - " <<
326 // ===================== Test perform of IndexedMap type ==========================
327 void CompIndexedMap (const Standard_Integer theRep,
328 const Standard_Integer theSize)
330 Standard_Integer i,j;
332 ////////////////////////////////Perf_Meter aNBind ("NCollection_IndexedMap adding",0);
333 ////////////////////////////////Perf_Meter aTBind ("TCollection_IndexedMap adding",0);
334 ////////////////////////////////Perf_Meter aNOper ("NCollection_IndexedMap operator=",0);
335 ////////////////////////////////Perf_Meter aTOper ("TCollection_IndexedMap operator=",0);
336 ////////////////////////////////Perf_Meter aNFind ("NCollection_IndexedMap finding",0);
337 ////////////////////////////////Perf_Meter aTFind ("TCollection_IndexedMap finding",0);
338 ////////////////////////////////Perf_Meter aNClea ("NCollection_IndexedMap clearing",0);
339 ////////////////////////////////Perf_Meter aTClea ("TCollection_IndexedMap clearing",0);
340 ////////////////////////////////Perf_Meter aNAssi ("NCollection_IndexedMap Assign",0);
342 for (i=0; i<theRep; i++)
344 ////////////////////////////////QANCollection_IndexedMap a1, a2;
345 QANCollection_IndexedMapPerf a1, a2;
346 ////////////////////////////////aNBind.Start();
347 PERF_START_METER("NCollection_IndexedMap adding")
348 for (j=1; j<=theSize; j++)
354 ////////////////////////////////aNBind.Stop();
355 PERF_STOP_METER("NCollection_IndexedMap adding")
356 ////////////////////////////////aNFind.Start();
357 PERF_START_METER("NCollection_IndexedMap finding")
358 for (j=1; j<=theSize; j++)
364 ////////////////////////////////aNFind.Stop();
365 PERF_STOP_METER("NCollection_IndexedMap finding")
366 ////////////////////////////////aNOper.Start();
367 PERF_START_METER("NCollection_IndexedMap operator=")
369 ////////////////////////////////aNOper.Stop();
370 PERF_STOP_METER("NCollection_IndexedMap operator=")
371 ////////////////////////////////aNAssi.Start();
372 PERF_START_METER("NCollection_IndexedMap Assign")
374 ////////////////////////////////aNAssi.Stop();
375 PERF_STOP_METER("NCollection_IndexedMap Assign")
376 ////////////////////////////////aNClea.Start();
377 PERF_START_METER("NCollection_IndexedMap clearing")
379 ////////////////////////////////aNClea.Stop();
380 PERF_STOP_METER("NCollection_IndexedMap clearing")
383 for (i=0; i<theRep; i++)
385 TColStd_IndexedMapOfReal a1, a2;
386 ////////////////////////////////aTBind.Start();
387 PERF_START_METER("TCollection_IndexedMap adding")
388 for (j=1; j<=theSize; j++)
394 ////////////////////////////////aTBind.Stop();
395 PERF_STOP_METER("TCollection_IndexedMap adding")
396 ////////////////////////////////aTFind.Start();
397 PERF_START_METER("TCollection_IndexedMap finding")
398 for (j=1; j<=theSize; j++)
404 ////////////////////////////////aTFind.Stop();
405 PERF_STOP_METER("TCollection_IndexedMap finding")
406 ////////////////////////////////aTOper.Start();
407 PERF_START_METER("TCollection_IndexedMap operator=")
409 ////////////////////////////////aTOper.Stop();
410 PERF_STOP_METER("TCollection_IndexedMap operator=")
411 ////////////////////////////////aTClea.Start();
412 PERF_START_METER("TCollection_IndexedMap clearing")
414 ////////////////////////////////aTClea.Stop();
415 PERF_STOP_METER("TCollection_IndexedMap clearing")
420 // ===================== Test perform of IndexedDataMap type ==========================
421 void CompIndexedDataMap (const Standard_Integer theRep,
422 const Standard_Integer theSize)
424 Standard_Integer i,j;
426 ////////////////////////////////Perf_Meter aNBind ("NCollection_IndexedDataMap binding",0);
427 ////////////////////////////////Perf_Meter aTBind ("TCollection_IndexedDataMap binding",0);
428 ////////////////////////////////Perf_Meter aNFind ("NCollection_IndexedDataMap finding",0);
429 ////////////////////////////////Perf_Meter aTFind ("TCollection_IndexedDataMap finding",0);
430 ////////////////////////////////Perf_Meter aNOper ("NCollection_IndexedDataMap operator=",0);
431 ////////////////////////////////Perf_Meter aTOper ("TCollection_IndexedDataMap operator=",0);
432 ////////////////////////////////Perf_Meter aNClea ("NCollection_IndexedDataMap clearing",0);
433 ////////////////////////////////Perf_Meter aTClea ("TCollection_IndexedDataMap clearing",0);
434 //////////////////////////////////Perf_Meter aNAssi ("NCollection_IndexedDataMap Assign",0);
436 for (i=0; i<theRep; i++)
438 ////////////////////////////////QANCollection_IDMap a1, a2;
439 QANCollection_IDMapPerf a1, a2;
440 ////////////////////////////////aNBind.Start();
441 PERF_START_METER("NCollection_IndexedDataMap binding")
442 for (j=1; j<=theSize; j++)
448 a1.Add(aKey1,anItem);
450 ////////////////////////////////aNBind.Stop();
451 PERF_STOP_METER("NCollection_IndexedDataMap binding")
452 ////////////////////////////////aNFind.Start();
453 PERF_START_METER("NCollection_IndexedDataMap finding")
454 for (j=1; j<=theSize; j++)
460 ////////////////////////////////aNFind.Stop();
461 PERF_STOP_METER("NCollection_IndexedDataMap finding")
462 ////////////////////////////////aNOper.Start();
463 PERF_START_METER("NCollection_IndexedDataMap operator=")
465 ////////////////////////////////aNOper.Stop();
466 PERF_STOP_METER("NCollection_IndexedDataMap operator=")
470 ////////////////////////////////aNClea.Start();
471 PERF_START_METER("NCollection_IndexedDataMap clearing")
473 ////////////////////////////////aNClea.Stop();
474 PERF_STOP_METER("NCollection_IndexedDataMap clearing")
477 for (i=0; i<theRep; i++)
479 QANCollection_IndexedDataMapOfRealPnt a1, a2;
480 ////////////////////////////////aTBind.Start();
481 PERF_START_METER("TCollection_IndexedDataMap binding")
482 for (j=1; j<=theSize; j++)
488 a1.Add(aKey1,anItem);
490 ////////////////////////////////aTBind.Stop();
491 PERF_STOP_METER("TCollection_IndexedDataMap binding")
492 ////////////////////////////////aTFind.Start();
493 PERF_START_METER("TCollection_IndexedDataMap finding")
494 for (j=1; j<=theSize; j++)
500 ////////////////////////////////aTFind.Stop();
501 PERF_STOP_METER("TCollection_IndexedDataMap finding")
502 ////////////////////////////////aTOper.Start();
503 PERF_START_METER("TCollection_IndexedDataMap operator=")
505 ////////////////////////////////aTOper.Stop();
506 PERF_STOP_METER("TCollection_IndexedDataMap operator=")
507 ////////////////////////////////aTClea.Start();
508 PERF_START_METER("TCollection_IndexedDataMap clearing")
510 ////////////////////////////////aTClea.Stop();
511 PERF_STOP_METER("TCollection_IndexedDataMap clearing")