1 // Created on: 2002-04-30
2 // Created by: Alexander KARTOMIN (akm)
3 // Copyright (c) 2002-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
22 #ifndef QANCollection_PerfMaps_HeaderFile
23 #define QANCollection_PerfMaps_HeaderFile
25 #include <TColStd_MapOfReal.hxx>
26 #include <TColStd_IndexedMapOfReal.hxx>
27 #include <QANCollection_DataMapOfRealPnt.hxx>
28 #include <QANCollection_DoubleMapOfRealInteger.hxx>
29 #include <QANCollection_IndexedDataMapOfRealPnt.hxx>
31 // ===================== Test perform of Map type ==========================
32 void CompMap (const Standard_Integer theRep,
33 const Standard_Integer theSize)
37 ////////////////////////////////Perf_Meter aNBind ("NCollection_Map adding",0);
38 ////////////////////////////////Perf_Meter aTBind ("TCollection_Map adding",0);
39 ////////////////////////////////Perf_Meter aNOper ("NCollection_Map operator=",0);
40 ////////////////////////////////Perf_Meter aTOper ("TCollection_Map operator=",0);
41 ////////////////////////////////Perf_Meter aNFind ("NCollection_Map finding",0);
42 ////////////////////////////////Perf_Meter aTFind ("TCollection_Map finding",0);
43 ////////////////////////////////Perf_Meter aNClea ("NCollection_Map clearing",0);
44 ////////////////////////////////Perf_Meter aTClea ("TCollection_Map clearing",0);
45 ////////////////////////////////Perf_Meter aNAssi ("NCollection_Map Assign",0);
46 for (i=0; i<theRep; i++)
48 ////////////////////////////////QANCollection_Map a1, a2;
49 QANCollection_MapPerf a1, a2;
50 ////////////////////////////////aNBind.Start();
51 PERF_START_METER("NCollection_Map adding")
52 for (j=1; j<=theSize; j++)
58 ////////////////////////////////aNBind.Stop();
59 PERF_STOP_METER("NCollection_Map adding")
60 ////////////////////////////////aNFind.Start();
61 PERF_START_METER("NCollection_Map finding")
62 for (j=1; j<=theSize; j++)
68 ////////////////////////////////aNFind.Stop();
69 PERF_STOP_METER("NCollection_Map finding")
70 ////////////////////////////////aNOper.Start();
71 PERF_START_METER("NCollection_Map operator=")
73 ////////////////////////////////aNOper.Stop();
74 PERF_STOP_METER("NCollection_Map operator=")
75 ////////////////////////////////aNAssi.Start();
76 PERF_START_METER("NCollection_Map Assign")
78 ////////////////////////////////aNAssi.Stop();
79 PERF_STOP_METER("NCollection_Map Assign")
80 ////////////////////////////////aNClea.Start();
81 PERF_START_METER("NCollection_Map clearing")
83 ////////////////////////////////aNClea.Stop();
84 PERF_STOP_METER("NCollection_Map clearing")
87 for (i=0; i<theRep; i++)
89 TColStd_MapOfReal a1, a2;
90 ////////////////////////////////aTBind.Start();
91 PERF_START_METER("TCollection_Map adding")
92 for (j=1; j<=theSize; j++)
98 ////////////////////////////////aTBind.Stop();
99 PERF_STOP_METER("TCollection_Map adding")
100 ////////////////////////////////aTFind.Start();
101 PERF_START_METER("TCollection_Map finding")
102 for (j=1; j<=theSize; j++)
108 ////////////////////////////////aTFind.Stop();
109 PERF_STOP_METER("TCollection_Map finding")
110 ////////////////////////////////aTOper.Start();
111 PERF_START_METER("TCollection_Map operator=")
113 ////////////////////////////////aTOper.Stop();
114 PERF_STOP_METER("TCollection_Map operator=")
115 ////////////////////////////////aTClea.Start();
116 PERF_START_METER("TCollection_Map clearing")
118 ////////////////////////////////aTClea.Stop();
119 PERF_STOP_METER("TCollection_Map clearing")
124 // ===================== Test perform of DataMap type ==========================
125 void CompDataMap (const Standard_Integer theRep,
126 const Standard_Integer theSize)
128 Standard_Integer i,j;
130 ////////////////////////////////Perf_Meter aNBind ("NCollection_DataMap binding",0);
131 ////////////////////////////////Perf_Meter aTBind ("TCollection_DataMap binding",0);
132 ////////////////////////////////Perf_Meter aNFind ("NCollection_DataMap finding",0);
133 ////////////////////////////////Perf_Meter aTFind ("TCollection_DataMap finding",0);
134 ////////////////////////////////Perf_Meter aNOper ("NCollection_DataMap operator=",0);
135 ////////////////////////////////Perf_Meter aTOper ("TCollection_DataMap operator=",0);
136 ////////////////////////////////Perf_Meter aNClea ("NCollection_DataMap clearing",0);
137 ////////////////////////////////Perf_Meter aTClea ("TCollection_DataMap clearing",0);
138 //////////////////////////////////Perf_Meter aNAssi ("NCollection_DataMap Assign",0);
139 for (i=0; i<theRep; i++)
141 ////////////////////////////////QANCollection_DataMap a1, a2;
142 QANCollection_DataMapPerf a1, a2;
143 ////////////////////////////////aNBind.Start();
144 PERF_START_METER("NCollection_DataMap binding")
145 for (j=1; j<=theSize; j++)
151 a1.Bind(aKey1,anItem);
153 ////////////////////////////////aNBind.Stop();
154 PERF_STOP_METER("NCollection_DataMap binding")
155 ////////////////////////////////aNFind.Start();
156 PERF_START_METER("NCollection_DataMap finding")
157 for (j=1; j<=theSize; j++)
163 ////////////////////////////////aNFind.Stop();
164 PERF_STOP_METER("NCollection_DataMap finding")
165 ////////////////////////////////aNOper.Start();
166 PERF_START_METER("NCollection_DataMap operator=")
168 ////////////////////////////////aNOper.Stop();
169 PERF_STOP_METER("NCollection_DataMap operator=")
173 ////////////////////////////////aNClea.Start();
174 PERF_START_METER("NCollection_DataMap clearing")
176 ////////////////////////////////aNClea.Stop();
177 PERF_STOP_METER("NCollection_DataMap clearing")
180 for (i=0; i<theRep; i++)
182 QANCollection_DataMapOfRealPnt a1, a2;
183 ////////////////////////////////aTBind.Start();
184 PERF_START_METER("TCollection_DataMap binding")
185 for (j=1; j<=theSize; j++)
191 a1.Bind(aKey1,anItem);
193 ////////////////////////////////aTBind.Stop();
194 PERF_STOP_METER("TCollection_DataMap binding")
195 ////////////////////////////////aTFind.Start();
196 PERF_START_METER("TCollection_DataMap finding")
197 for (j=1; j<=theSize; j++)
203 ////////////////////////////////aTFind.Stop();
204 PERF_STOP_METER("TCollection_DataMap finding")
205 ////////////////////////////////aTOper.Start();
206 PERF_START_METER("TCollection_DataMap operator=")
208 ////////////////////////////////aTOper.Stop();
209 PERF_STOP_METER("TCollection_DataMap operator=")
210 ////////////////////////////////aTClea.Start();
211 PERF_START_METER("TCollection_DataMap clearing")
213 ////////////////////////////////aTClea.Stop();
214 PERF_STOP_METER("TCollection_DataMap clearing")
219 // ===================== Test perform of DoubleMap type ==========================
220 void CompDoubleMap (const Standard_Integer theRep,
221 const Standard_Integer theSize)
223 Standard_Integer i,j;
224 Standard_Integer iFail1=0, iFail2=0;
226 ////////////////////////////////Perf_Meter aNBind ("NCollection_DoubleMap binding",0);
227 ////////////////////////////////Perf_Meter aTBind ("TCollection_DoubleMap binding",0);
228 ////////////////////////////////Perf_Meter aNFind ("NCollection_DoubleMap finding",0);
229 ////////////////////////////////Perf_Meter aTFind ("TCollection_DoubleMap finding",0);
230 ////////////////////////////////Perf_Meter aNOper ("NCollection_DoubleMap operator=",0);
231 ////////////////////////////////Perf_Meter aTOper ("TCollection_DoubleMap operator=",0);
232 ////////////////////////////////Perf_Meter aNClea ("NCollection_DoubleMap clearing",0);
233 ////////////////////////////////Perf_Meter aTClea ("TCollection_DoubleMap clearing",0);
234 //////////////////////////////////Perf_Meter aNAssi ("NCollection_DoubleMap Assign",0);
235 for (i=0; i<theRep; i++)
237 ////////////////////////////////QANCollection_DoubleMap a1, a2;
238 QANCollection_DoubleMapPerf a1, a2;
239 ////////////////////////////////aNBind.Start();
240 PERF_START_METER("NCollection_DoubleMap binding")
241 for (j=1; j<=theSize; j++)
250 while (a1.IsBound1(aKey1) || a1.IsBound2(aKey2));
252 a1.Bind(aKey1,aKey2);
254 ////////////////////////////////aNBind.Stop();
255 PERF_STOP_METER("NCollection_DoubleMap binding")
256 ////////////////////////////////aNFind.Start();
257 PERF_START_METER("NCollection_DoubleMap finding")
258 for (j=1; j<=theSize; j++)
264 a1.AreBound(aKey1,aKey2);
266 ////////////////////////////////aNFind.Stop();
267 PERF_STOP_METER("NCollection_DoubleMap finding")
268 ////////////////////////////////aNOper.Start();
269 PERF_START_METER("NCollection_DoubleMap operator=")
271 ////////////////////////////////aNOper.Stop();
272 PERF_STOP_METER("NCollection_DoubleMap operator=")
276 ////////////////////////////////aNClea.Start();
277 PERF_START_METER("NCollection_DoubleMap clearing")
279 ////////////////////////////////aNClea.Stop();
280 PERF_STOP_METER("NCollection_DoubleMap clearing")
283 for (i=0; i<theRep; i++)
285 QANCollection_DoubleMapOfRealInteger a1, a2;
286 ////////////////////////////////aTBind.Start();
287 PERF_START_METER("TCollection_DoubleMap binding")
288 for (j=1; j<=theSize; j++)
297 while (a1.IsBound1(aKey1) || a1.IsBound2(aKey2));
299 a1.Bind(aKey1,aKey2);
301 ////////////////////////////////aTBind.Stop();
302 PERF_STOP_METER("TCollection_DoubleMap binding")
303 ////////////////////////////////aTFind.Start();
304 PERF_START_METER("TCollection_DoubleMap finding")
305 for (j=1; j<=theSize; j++)
311 a1.AreBound(aKey1,aKey2);
313 ////////////////////////////////aTFind.Stop();
314 PERF_STOP_METER("TCollection_DoubleMap finding")
315 ////////////////////////////////aTOper.Start();
316 PERF_START_METER("TCollection_DoubleMap operator=")
318 ////////////////////////////////aTOper.Stop();
319 PERF_STOP_METER("TCollection_DoubleMap operator=")
320 ////////////////////////////////aTClea.Start();
321 PERF_START_METER("TCollection_DoubleMap clearing")
323 ////////////////////////////////aTClea.Stop();
324 PERF_STOP_METER("TCollection_DoubleMap clearing")
327 if (iFail1 || iFail2)
328 cout << "Warning : N map failed " << iFail1 << " times, T map - " <<
332 // ===================== Test perform of IndexedMap type ==========================
333 void CompIndexedMap (const Standard_Integer theRep,
334 const Standard_Integer theSize)
336 Standard_Integer i,j;
338 ////////////////////////////////Perf_Meter aNBind ("NCollection_IndexedMap adding",0);
339 ////////////////////////////////Perf_Meter aTBind ("TCollection_IndexedMap adding",0);
340 ////////////////////////////////Perf_Meter aNOper ("NCollection_IndexedMap operator=",0);
341 ////////////////////////////////Perf_Meter aTOper ("TCollection_IndexedMap operator=",0);
342 ////////////////////////////////Perf_Meter aNFind ("NCollection_IndexedMap finding",0);
343 ////////////////////////////////Perf_Meter aTFind ("TCollection_IndexedMap finding",0);
344 ////////////////////////////////Perf_Meter aNClea ("NCollection_IndexedMap clearing",0);
345 ////////////////////////////////Perf_Meter aTClea ("TCollection_IndexedMap clearing",0);
346 ////////////////////////////////Perf_Meter aNAssi ("NCollection_IndexedMap Assign",0);
348 for (i=0; i<theRep; i++)
350 ////////////////////////////////QANCollection_IndexedMap a1, a2;
351 QANCollection_IndexedMapPerf a1, a2;
352 ////////////////////////////////aNBind.Start();
353 PERF_START_METER("NCollection_IndexedMap adding")
354 for (j=1; j<=theSize; j++)
360 ////////////////////////////////aNBind.Stop();
361 PERF_STOP_METER("NCollection_IndexedMap adding")
362 ////////////////////////////////aNFind.Start();
363 PERF_START_METER("NCollection_IndexedMap finding")
364 for (j=1; j<=theSize; j++)
370 ////////////////////////////////aNFind.Stop();
371 PERF_STOP_METER("NCollection_IndexedMap finding")
372 ////////////////////////////////aNOper.Start();
373 PERF_START_METER("NCollection_IndexedMap operator=")
375 ////////////////////////////////aNOper.Stop();
376 PERF_STOP_METER("NCollection_IndexedMap operator=")
377 ////////////////////////////////aNAssi.Start();
378 PERF_START_METER("NCollection_IndexedMap Assign")
380 ////////////////////////////////aNAssi.Stop();
381 PERF_STOP_METER("NCollection_IndexedMap Assign")
382 ////////////////////////////////aNClea.Start();
383 PERF_START_METER("NCollection_IndexedMap clearing")
385 ////////////////////////////////aNClea.Stop();
386 PERF_STOP_METER("NCollection_IndexedMap clearing")
389 for (i=0; i<theRep; i++)
391 TColStd_IndexedMapOfReal a1, a2;
392 ////////////////////////////////aTBind.Start();
393 PERF_START_METER("TCollection_IndexedMap adding")
394 for (j=1; j<=theSize; j++)
400 ////////////////////////////////aTBind.Stop();
401 PERF_STOP_METER("TCollection_IndexedMap adding")
402 ////////////////////////////////aTFind.Start();
403 PERF_START_METER("TCollection_IndexedMap finding")
404 for (j=1; j<=theSize; j++)
410 ////////////////////////////////aTFind.Stop();
411 PERF_STOP_METER("TCollection_IndexedMap finding")
412 ////////////////////////////////aTOper.Start();
413 PERF_START_METER("TCollection_IndexedMap operator=")
415 ////////////////////////////////aTOper.Stop();
416 PERF_STOP_METER("TCollection_IndexedMap operator=")
417 ////////////////////////////////aTClea.Start();
418 PERF_START_METER("TCollection_IndexedMap clearing")
420 ////////////////////////////////aTClea.Stop();
421 PERF_STOP_METER("TCollection_IndexedMap clearing")
426 // ===================== Test perform of IndexedDataMap type ==========================
427 void CompIndexedDataMap (const Standard_Integer theRep,
428 const Standard_Integer theSize)
430 Standard_Integer i,j;
432 ////////////////////////////////Perf_Meter aNBind ("NCollection_IndexedDataMap binding",0);
433 ////////////////////////////////Perf_Meter aTBind ("TCollection_IndexedDataMap binding",0);
434 ////////////////////////////////Perf_Meter aNFind ("NCollection_IndexedDataMap finding",0);
435 ////////////////////////////////Perf_Meter aTFind ("TCollection_IndexedDataMap finding",0);
436 ////////////////////////////////Perf_Meter aNOper ("NCollection_IndexedDataMap operator=",0);
437 ////////////////////////////////Perf_Meter aTOper ("TCollection_IndexedDataMap operator=",0);
438 ////////////////////////////////Perf_Meter aNClea ("NCollection_IndexedDataMap clearing",0);
439 ////////////////////////////////Perf_Meter aTClea ("TCollection_IndexedDataMap clearing",0);
440 //////////////////////////////////Perf_Meter aNAssi ("NCollection_IndexedDataMap Assign",0);
442 for (i=0; i<theRep; i++)
444 ////////////////////////////////QANCollection_IDMap a1, a2;
445 QANCollection_IDMapPerf a1, a2;
446 ////////////////////////////////aNBind.Start();
447 PERF_START_METER("NCollection_IndexedDataMap binding")
448 for (j=1; j<=theSize; j++)
454 a1.Add(aKey1,anItem);
456 ////////////////////////////////aNBind.Stop();
457 PERF_STOP_METER("NCollection_IndexedDataMap binding")
458 ////////////////////////////////aNFind.Start();
459 PERF_START_METER("NCollection_IndexedDataMap finding")
460 for (j=1; j<=theSize; j++)
466 ////////////////////////////////aNFind.Stop();
467 PERF_STOP_METER("NCollection_IndexedDataMap finding")
468 ////////////////////////////////aNOper.Start();
469 PERF_START_METER("NCollection_IndexedDataMap operator=")
471 ////////////////////////////////aNOper.Stop();
472 PERF_STOP_METER("NCollection_IndexedDataMap operator=")
476 ////////////////////////////////aNClea.Start();
477 PERF_START_METER("NCollection_IndexedDataMap clearing")
479 ////////////////////////////////aNClea.Stop();
480 PERF_STOP_METER("NCollection_IndexedDataMap clearing")
483 for (i=0; i<theRep; i++)
485 QANCollection_IndexedDataMapOfRealPnt a1, a2;
486 ////////////////////////////////aTBind.Start();
487 PERF_START_METER("TCollection_IndexedDataMap binding")
488 for (j=1; j<=theSize; j++)
494 a1.Add(aKey1,anItem);
496 ////////////////////////////////aTBind.Stop();
497 PERF_STOP_METER("TCollection_IndexedDataMap binding")
498 ////////////////////////////////aTFind.Start();
499 PERF_START_METER("TCollection_IndexedDataMap finding")
500 for (j=1; j<=theSize; j++)
506 ////////////////////////////////aTFind.Stop();
507 PERF_STOP_METER("TCollection_IndexedDataMap finding")
508 ////////////////////////////////aTOper.Start();
509 PERF_START_METER("TCollection_IndexedDataMap operator=")
511 ////////////////////////////////aTOper.Stop();
512 PERF_STOP_METER("TCollection_IndexedDataMap operator=")
513 ////////////////////////////////aTClea.Start();
514 PERF_START_METER("TCollection_IndexedDataMap clearing")
516 ////////////////////////////////aTClea.Stop();
517 PERF_STOP_METER("TCollection_IndexedDataMap clearing")