1 // File: QANCollection_PerfMaps.hxx
2 // Created: Tue Apr 30 11:24:20 2002
3 // Author: Alexander KARTOMIN (akm)
4 // <a-kartomin@opencascade.com>
7 #ifndef QANCollection_PerfMaps_HeaderFile
8 #define QANCollection_PerfMaps_HeaderFile
10 #include <TColStd_MapOfReal.hxx>
11 #include <TColStd_IndexedMapOfReal.hxx>
12 #include <QANCollection_DataMapOfRealPnt.hxx>
13 #include <QANCollection_DoubleMapOfRealInteger.hxx>
14 #include <QANCollection_IndexedDataMapOfRealPnt.hxx>
16 // ===================== Test perform of Map type ==========================
17 void CompMap (const Standard_Integer theRep,
18 const Standard_Integer theSize)
22 ////////////////////////////////Perf_Meter aNBind ("NCollection_Map adding",0);
23 ////////////////////////////////Perf_Meter aTBind ("TCollection_Map adding",0);
24 ////////////////////////////////Perf_Meter aNOper ("NCollection_Map operator=",0);
25 ////////////////////////////////Perf_Meter aTOper ("TCollection_Map operator=",0);
26 ////////////////////////////////Perf_Meter aNFind ("NCollection_Map finding",0);
27 ////////////////////////////////Perf_Meter aTFind ("TCollection_Map finding",0);
28 ////////////////////////////////Perf_Meter aNClea ("NCollection_Map clearing",0);
29 ////////////////////////////////Perf_Meter aTClea ("TCollection_Map clearing",0);
30 ////////////////////////////////Perf_Meter aNAssi ("NCollection_Map Assign",0);
31 for (i=0; i<theRep; i++)
33 ////////////////////////////////QANCollection_Map a1, a2;
34 QANCollection_MapPerf a1, a2;
35 ////////////////////////////////aNBind.Start();
36 PERF_START_METER("NCollection_Map adding")
37 for (j=1; j<=theSize; j++)
43 ////////////////////////////////aNBind.Stop();
44 PERF_STOP_METER("NCollection_Map adding")
45 ////////////////////////////////aNFind.Start();
46 PERF_START_METER("NCollection_Map finding")
47 for (j=1; j<=theSize; j++)
53 ////////////////////////////////aNFind.Stop();
54 PERF_STOP_METER("NCollection_Map finding")
55 ////////////////////////////////aNOper.Start();
56 PERF_START_METER("NCollection_Map operator=")
58 ////////////////////////////////aNOper.Stop();
59 PERF_STOP_METER("NCollection_Map operator=")
60 ////////////////////////////////aNAssi.Start();
61 PERF_START_METER("NCollection_Map Assign")
63 ////////////////////////////////aNAssi.Stop();
64 PERF_STOP_METER("NCollection_Map Assign")
65 ////////////////////////////////aNClea.Start();
66 PERF_START_METER("NCollection_Map clearing")
68 ////////////////////////////////aNClea.Stop();
69 PERF_STOP_METER("NCollection_Map clearing")
72 for (i=0; i<theRep; i++)
74 TColStd_MapOfReal a1, a2;
75 ////////////////////////////////aTBind.Start();
76 PERF_START_METER("TCollection_Map adding")
77 for (j=1; j<=theSize; j++)
83 ////////////////////////////////aTBind.Stop();
84 PERF_STOP_METER("TCollection_Map adding")
85 ////////////////////////////////aTFind.Start();
86 PERF_START_METER("TCollection_Map finding")
87 for (j=1; j<=theSize; j++)
93 ////////////////////////////////aTFind.Stop();
94 PERF_STOP_METER("TCollection_Map finding")
95 ////////////////////////////////aTOper.Start();
96 PERF_START_METER("TCollection_Map operator=")
98 ////////////////////////////////aTOper.Stop();
99 PERF_STOP_METER("TCollection_Map operator=")
100 ////////////////////////////////aTClea.Start();
101 PERF_START_METER("TCollection_Map clearing")
103 ////////////////////////////////aTClea.Stop();
104 PERF_STOP_METER("TCollection_Map clearing")
106 PERF_PRINT_ALL_METERS
109 // ===================== Test perform of DataMap type ==========================
110 void CompDataMap (const Standard_Integer theRep,
111 const Standard_Integer theSize)
113 Standard_Integer i,j;
115 ////////////////////////////////Perf_Meter aNBind ("NCollection_DataMap binding",0);
116 ////////////////////////////////Perf_Meter aTBind ("TCollection_DataMap binding",0);
117 ////////////////////////////////Perf_Meter aNFind ("NCollection_DataMap finding",0);
118 ////////////////////////////////Perf_Meter aTFind ("TCollection_DataMap finding",0);
119 ////////////////////////////////Perf_Meter aNOper ("NCollection_DataMap operator=",0);
120 ////////////////////////////////Perf_Meter aTOper ("TCollection_DataMap operator=",0);
121 ////////////////////////////////Perf_Meter aNClea ("NCollection_DataMap clearing",0);
122 ////////////////////////////////Perf_Meter aTClea ("TCollection_DataMap clearing",0);
123 //////////////////////////////////Perf_Meter aNAssi ("NCollection_DataMap Assign",0);
124 for (i=0; i<theRep; i++)
126 ////////////////////////////////QANCollection_DataMap a1, a2;
127 QANCollection_DataMapPerf a1, a2;
128 ////////////////////////////////aNBind.Start();
129 PERF_START_METER("NCollection_DataMap binding")
130 for (j=1; j<=theSize; j++)
136 a1.Bind(aKey1,anItem);
138 ////////////////////////////////aNBind.Stop();
139 PERF_STOP_METER("NCollection_DataMap binding")
140 ////////////////////////////////aNFind.Start();
141 PERF_START_METER("NCollection_DataMap finding")
142 for (j=1; j<=theSize; j++)
148 ////////////////////////////////aNFind.Stop();
149 PERF_STOP_METER("NCollection_DataMap finding")
150 ////////////////////////////////aNOper.Start();
151 PERF_START_METER("NCollection_DataMap operator=")
153 ////////////////////////////////aNOper.Stop();
154 PERF_STOP_METER("NCollection_DataMap operator=")
158 ////////////////////////////////aNClea.Start();
159 PERF_START_METER("NCollection_DataMap clearing")
161 ////////////////////////////////aNClea.Stop();
162 PERF_STOP_METER("NCollection_DataMap clearing")
165 for (i=0; i<theRep; i++)
167 QANCollection_DataMapOfRealPnt a1, a2;
168 ////////////////////////////////aTBind.Start();
169 PERF_START_METER("TCollection_DataMap binding")
170 for (j=1; j<=theSize; j++)
176 a1.Bind(aKey1,anItem);
178 ////////////////////////////////aTBind.Stop();
179 PERF_STOP_METER("TCollection_DataMap binding")
180 ////////////////////////////////aTFind.Start();
181 PERF_START_METER("TCollection_DataMap finding")
182 for (j=1; j<=theSize; j++)
188 ////////////////////////////////aTFind.Stop();
189 PERF_STOP_METER("TCollection_DataMap finding")
190 ////////////////////////////////aTOper.Start();
191 PERF_START_METER("TCollection_DataMap operator=")
193 ////////////////////////////////aTOper.Stop();
194 PERF_STOP_METER("TCollection_DataMap operator=")
195 ////////////////////////////////aTClea.Start();
196 PERF_START_METER("TCollection_DataMap clearing")
198 ////////////////////////////////aTClea.Stop();
199 PERF_STOP_METER("TCollection_DataMap clearing")
201 PERF_PRINT_ALL_METERS
204 // ===================== Test perform of DoubleMap type ==========================
205 void CompDoubleMap (const Standard_Integer theRep,
206 const Standard_Integer theSize)
208 Standard_Integer i,j;
209 Standard_Integer iFail1=0, iFail2=0;
211 ////////////////////////////////Perf_Meter aNBind ("NCollection_DoubleMap binding",0);
212 ////////////////////////////////Perf_Meter aTBind ("TCollection_DoubleMap binding",0);
213 ////////////////////////////////Perf_Meter aNFind ("NCollection_DoubleMap finding",0);
214 ////////////////////////////////Perf_Meter aTFind ("TCollection_DoubleMap finding",0);
215 ////////////////////////////////Perf_Meter aNOper ("NCollection_DoubleMap operator=",0);
216 ////////////////////////////////Perf_Meter aTOper ("TCollection_DoubleMap operator=",0);
217 ////////////////////////////////Perf_Meter aNClea ("NCollection_DoubleMap clearing",0);
218 ////////////////////////////////Perf_Meter aTClea ("TCollection_DoubleMap clearing",0);
219 //////////////////////////////////Perf_Meter aNAssi ("NCollection_DoubleMap Assign",0);
220 for (i=0; i<theRep; i++)
222 ////////////////////////////////QANCollection_DoubleMap a1, a2;
223 QANCollection_DoubleMapPerf a1, a2;
224 ////////////////////////////////aNBind.Start();
225 PERF_START_METER("NCollection_DoubleMap binding")
226 for (j=1; j<=theSize; j++)
235 while (a1.IsBound1(aKey1) || a1.IsBound2(aKey2));
237 a1.Bind(aKey1,aKey2);
239 ////////////////////////////////aNBind.Stop();
240 PERF_STOP_METER("NCollection_DoubleMap binding")
241 ////////////////////////////////aNFind.Start();
242 PERF_START_METER("NCollection_DoubleMap finding")
243 for (j=1; j<=theSize; j++)
249 a1.AreBound(aKey1,aKey2);
251 ////////////////////////////////aNFind.Stop();
252 PERF_STOP_METER("NCollection_DoubleMap finding")
253 ////////////////////////////////aNOper.Start();
254 PERF_START_METER("NCollection_DoubleMap operator=")
256 ////////////////////////////////aNOper.Stop();
257 PERF_STOP_METER("NCollection_DoubleMap operator=")
261 ////////////////////////////////aNClea.Start();
262 PERF_START_METER("NCollection_DoubleMap clearing")
264 ////////////////////////////////aNClea.Stop();
265 PERF_STOP_METER("NCollection_DoubleMap clearing")
268 for (i=0; i<theRep; i++)
270 QANCollection_DoubleMapOfRealInteger a1, a2;
271 ////////////////////////////////aTBind.Start();
272 PERF_START_METER("TCollection_DoubleMap binding")
273 for (j=1; j<=theSize; j++)
282 while (a1.IsBound1(aKey1) || a1.IsBound2(aKey2));
284 a1.Bind(aKey1,aKey2);
286 ////////////////////////////////aTBind.Stop();
287 PERF_STOP_METER("TCollection_DoubleMap binding")
288 ////////////////////////////////aTFind.Start();
289 PERF_START_METER("TCollection_DoubleMap finding")
290 for (j=1; j<=theSize; j++)
296 a1.AreBound(aKey1,aKey2);
298 ////////////////////////////////aTFind.Stop();
299 PERF_STOP_METER("TCollection_DoubleMap finding")
300 ////////////////////////////////aTOper.Start();
301 PERF_START_METER("TCollection_DoubleMap operator=")
303 ////////////////////////////////aTOper.Stop();
304 PERF_STOP_METER("TCollection_DoubleMap operator=")
305 ////////////////////////////////aTClea.Start();
306 PERF_START_METER("TCollection_DoubleMap clearing")
308 ////////////////////////////////aTClea.Stop();
309 PERF_STOP_METER("TCollection_DoubleMap clearing")
311 PERF_PRINT_ALL_METERS
312 if (iFail1 || iFail2)
313 cout << "Warning : N map failed " << iFail1 << " times, T map - " <<
317 // ===================== Test perform of IndexedMap type ==========================
318 void CompIndexedMap (const Standard_Integer theRep,
319 const Standard_Integer theSize)
321 Standard_Integer i,j;
323 ////////////////////////////////Perf_Meter aNBind ("NCollection_IndexedMap adding",0);
324 ////////////////////////////////Perf_Meter aTBind ("TCollection_IndexedMap adding",0);
325 ////////////////////////////////Perf_Meter aNOper ("NCollection_IndexedMap operator=",0);
326 ////////////////////////////////Perf_Meter aTOper ("TCollection_IndexedMap operator=",0);
327 ////////////////////////////////Perf_Meter aNFind ("NCollection_IndexedMap finding",0);
328 ////////////////////////////////Perf_Meter aTFind ("TCollection_IndexedMap finding",0);
329 ////////////////////////////////Perf_Meter aNClea ("NCollection_IndexedMap clearing",0);
330 ////////////////////////////////Perf_Meter aTClea ("TCollection_IndexedMap clearing",0);
331 ////////////////////////////////Perf_Meter aNAssi ("NCollection_IndexedMap Assign",0);
333 for (i=0; i<theRep; i++)
335 ////////////////////////////////QANCollection_IndexedMap a1, a2;
336 QANCollection_IndexedMapPerf a1, a2;
337 ////////////////////////////////aNBind.Start();
338 PERF_START_METER("NCollection_IndexedMap adding")
339 for (j=1; j<=theSize; j++)
345 ////////////////////////////////aNBind.Stop();
346 PERF_STOP_METER("NCollection_IndexedMap adding")
347 ////////////////////////////////aNFind.Start();
348 PERF_START_METER("NCollection_IndexedMap finding")
349 for (j=1; j<=theSize; j++)
355 ////////////////////////////////aNFind.Stop();
356 PERF_STOP_METER("NCollection_IndexedMap finding")
357 ////////////////////////////////aNOper.Start();
358 PERF_START_METER("NCollection_IndexedMap operator=")
360 ////////////////////////////////aNOper.Stop();
361 PERF_STOP_METER("NCollection_IndexedMap operator=")
362 ////////////////////////////////aNAssi.Start();
363 PERF_START_METER("NCollection_IndexedMap Assign")
365 ////////////////////////////////aNAssi.Stop();
366 PERF_STOP_METER("NCollection_IndexedMap Assign")
367 ////////////////////////////////aNClea.Start();
368 PERF_START_METER("NCollection_IndexedMap clearing")
370 ////////////////////////////////aNClea.Stop();
371 PERF_STOP_METER("NCollection_IndexedMap clearing")
374 for (i=0; i<theRep; i++)
376 TColStd_IndexedMapOfReal a1, a2;
377 ////////////////////////////////aTBind.Start();
378 PERF_START_METER("TCollection_IndexedMap adding")
379 for (j=1; j<=theSize; j++)
385 ////////////////////////////////aTBind.Stop();
386 PERF_STOP_METER("TCollection_IndexedMap adding")
387 ////////////////////////////////aTFind.Start();
388 PERF_START_METER("TCollection_IndexedMap finding")
389 for (j=1; j<=theSize; j++)
395 ////////////////////////////////aTFind.Stop();
396 PERF_STOP_METER("TCollection_IndexedMap finding")
397 ////////////////////////////////aTOper.Start();
398 PERF_START_METER("TCollection_IndexedMap operator=")
400 ////////////////////////////////aTOper.Stop();
401 PERF_STOP_METER("TCollection_IndexedMap operator=")
402 ////////////////////////////////aTClea.Start();
403 PERF_START_METER("TCollection_IndexedMap clearing")
405 ////////////////////////////////aTClea.Stop();
406 PERF_STOP_METER("TCollection_IndexedMap clearing")
408 PERF_PRINT_ALL_METERS
411 // ===================== Test perform of IndexedDataMap type ==========================
412 void CompIndexedDataMap (const Standard_Integer theRep,
413 const Standard_Integer theSize)
415 Standard_Integer i,j;
417 ////////////////////////////////Perf_Meter aNBind ("NCollection_IndexedDataMap binding",0);
418 ////////////////////////////////Perf_Meter aTBind ("TCollection_IndexedDataMap binding",0);
419 ////////////////////////////////Perf_Meter aNFind ("NCollection_IndexedDataMap finding",0);
420 ////////////////////////////////Perf_Meter aTFind ("TCollection_IndexedDataMap finding",0);
421 ////////////////////////////////Perf_Meter aNOper ("NCollection_IndexedDataMap operator=",0);
422 ////////////////////////////////Perf_Meter aTOper ("TCollection_IndexedDataMap operator=",0);
423 ////////////////////////////////Perf_Meter aNClea ("NCollection_IndexedDataMap clearing",0);
424 ////////////////////////////////Perf_Meter aTClea ("TCollection_IndexedDataMap clearing",0);
425 //////////////////////////////////Perf_Meter aNAssi ("NCollection_IndexedDataMap Assign",0);
427 for (i=0; i<theRep; i++)
429 ////////////////////////////////QANCollection_IDMap a1, a2;
430 QANCollection_IDMapPerf a1, a2;
431 ////////////////////////////////aNBind.Start();
432 PERF_START_METER("NCollection_IndexedDataMap binding")
433 for (j=1; j<=theSize; j++)
439 a1.Add(aKey1,anItem);
441 ////////////////////////////////aNBind.Stop();
442 PERF_STOP_METER("NCollection_IndexedDataMap binding")
443 ////////////////////////////////aNFind.Start();
444 PERF_START_METER("NCollection_IndexedDataMap finding")
445 for (j=1; j<=theSize; j++)
451 ////////////////////////////////aNFind.Stop();
452 PERF_STOP_METER("NCollection_IndexedDataMap finding")
453 ////////////////////////////////aNOper.Start();
454 PERF_START_METER("NCollection_IndexedDataMap operator=")
456 ////////////////////////////////aNOper.Stop();
457 PERF_STOP_METER("NCollection_IndexedDataMap operator=")
461 ////////////////////////////////aNClea.Start();
462 PERF_START_METER("NCollection_IndexedDataMap clearing")
464 ////////////////////////////////aNClea.Stop();
465 PERF_STOP_METER("NCollection_IndexedDataMap clearing")
468 for (i=0; i<theRep; i++)
470 QANCollection_IndexedDataMapOfRealPnt a1, a2;
471 ////////////////////////////////aTBind.Start();
472 PERF_START_METER("TCollection_IndexedDataMap binding")
473 for (j=1; j<=theSize; j++)
479 a1.Add(aKey1,anItem);
481 ////////////////////////////////aTBind.Stop();
482 PERF_STOP_METER("TCollection_IndexedDataMap binding")
483 ////////////////////////////////aTFind.Start();
484 PERF_START_METER("TCollection_IndexedDataMap finding")
485 for (j=1; j<=theSize; j++)
491 ////////////////////////////////aTFind.Stop();
492 PERF_STOP_METER("TCollection_IndexedDataMap finding")
493 ////////////////////////////////aTOper.Start();
494 PERF_START_METER("TCollection_IndexedDataMap operator=")
496 ////////////////////////////////aTOper.Stop();
497 PERF_STOP_METER("TCollection_IndexedDataMap operator=")
498 ////////////////////////////////aTClea.Start();
499 PERF_START_METER("TCollection_IndexedDataMap clearing")
501 ////////////////////////////////aTClea.Stop();
502 PERF_STOP_METER("TCollection_IndexedDataMap clearing")
504 PERF_PRINT_ALL_METERS