0024186: Eliminate remaining compiler warnings in MSVC++ 2010 64 bit with warning...
[occt.git] / src / QANCollection / QANCollection_PerfLists.hxx
1 // Created on: 2002-04-30
2 // Created by: Alexander KARTOMIN (akm)
3 // Copyright (c) 2002-2012 OPEN CASCADE SAS
4 //
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.
9 //
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.
12 //
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.
19
20
21
22 #ifndef QANCollection_PerfLists_HeaderFile
23 #define QANCollection_PerfLists_HeaderFile
24
25 #include <QANCollection_ListOfPnt.hxx>
26 #include <QANCollection_SListOfPnt.hxx>
27 #include <QANCollection_QueueOfPnt.hxx>
28 #include <QANCollection_StackOfPnt.hxx>
29 #include <TColgp_SequenceOfPnt.hxx>
30 #include <TColStd_SetOfInteger.hxx>
31
32 // ===================== Test perform of List type ==========================
33 void CompList (const Standard_Integer theRep,
34                const Standard_Integer theSize)
35 {
36   Standard_Integer i,j;
37
38   ////////////////////////////////Perf_Meter aNAppe ("NCollection_List appending",0);
39   ////////////////////////////////Perf_Meter aTAppe ("TCollection_List appending",0);
40   ////////////////////////////////Perf_Meter aNOper ("NCollection_List operator=",0);
41   ////////////////////////////////Perf_Meter aTOper ("TCollection_List operator=",0);
42   ////////////////////////////////Perf_Meter aNClea ("NCollection_List clearing",0);
43   ////////////////////////////////Perf_Meter aTClea ("TCollection_List clearing",0);
44   ////////////////////////////////Perf_Meter aNAssi ("NCollection_List Assign",0);
45   for (i=0; i<theRep; i++)
46     {
47       ////////////////////////////////QANCollection_List a1, a2;
48       QANCollection_ListPerf a1, a2;
49       ////////////////////////////////aNAppe.Start();
50       PERF_START_METER("NCollection_List appending")
51       for (j=1; j<=theSize; j++)
52         {
53           ItemType anItem;
54           Random(anItem);
55           a1.Append(anItem);
56         }
57       ////////////////////////////////aNAppe.Stop();
58       PERF_STOP_METER("NCollection_List appending")
59       ////////////////////////////////aNOper.Start();
60       PERF_START_METER("NCollection_List operator=")
61       a2 = a1;
62       ////////////////////////////////aNOper.Stop();
63       PERF_STOP_METER("NCollection_List operator=")
64       ////////////////////////////////aNAssi.Start();
65       PERF_START_METER("NCollection_List Assign")
66       a2.Assign(a1);
67       ////////////////////////////////aNAssi.Stop();
68       PERF_STOP_METER("NCollection_List Assign")
69       ////////////////////////////////aNClea.Start();
70       PERF_START_METER("NCollection_List clearing")
71       a2.Clear();
72       ////////////////////////////////aNClea.Stop();
73       PERF_STOP_METER("NCollection_List clearing")
74     }
75
76   for (i=0; i<theRep; i++)
77     {
78       QANCollection_ListOfPnt a1, a2;
79       ////////////////////////////////aTAppe.Start();
80       PERF_START_METER("TCollection_List appending")
81       for (j=1; j<=theSize; j++)
82         {
83           ItemType anItem;
84           Random(anItem);
85           a1.Append(anItem);
86         }
87       ////////////////////////////////aTAppe.Stop();
88       PERF_STOP_METER("TCollection_List appending")
89       ////////////////////////////////aTOper.Start();
90       PERF_START_METER("TCollection_List operator=")
91       a2 = a1;
92       ////////////////////////////////aTOper.Stop();
93       PERF_STOP_METER("TCollection_List operator=")
94       ////////////////////////////////aTClea.Start();
95       PERF_START_METER("TCollection_List clearing")
96       a2.Clear();
97       ////////////////////////////////aTClea.Stop();
98       PERF_STOP_METER("TCollection_List clearing")
99     }
100   PERF_PRINT_ALL
101 }
102
103 // ===================== Test perform of Queue type ==========================
104 void CompQueue (const Standard_Integer theRep,
105                 const Standard_Integer theSize)
106 {
107   Standard_Integer i,j;
108
109   ////////////////////////////////Perf_Meter aNPush ("NCollection_Queue pushing",0);
110   ////////////////////////////////Perf_Meter aTPush ("TCollection_Queue pushing",0);
111   ////////////////////////////////Perf_Meter aNPopp ("NCollection_Queue popping",0);
112   ////////////////////////////////Perf_Meter aTPopp ("TCollection_Queue popping",0);
113   ////////////////////////////////Perf_Meter aNOper ("NCollection_Queue operator=",0);
114   ////////////////////////////////Perf_Meter aTOper ("TCollection_Queue operator=",0);
115   ////////////////////////////////Perf_Meter aNClea ("NCollection_Queue clearing",0);
116   ////////////////////////////////Perf_Meter aTClea ("TCollection_Queue clearing",0);
117   ////////////////////////////////Perf_Meter aNAssi ("NCollection_Queue Assign",0);
118   for (i=0; i<theRep; i++)
119     {
120       ////////////////////////////////QANCollection_Queue a1, a2;
121       QANCollection_QueuePerf a1, a2;
122       ////////////////////////////////aNPush.Start();
123       PERF_START_METER("NCollection_Queue pushing")
124       for (j=1; j<=theSize; j++)
125         {
126           ItemType anItem;
127           Random(anItem);
128           a1.Push(anItem);
129         }
130       ////////////////////////////////aNPush.Stop();
131       PERF_STOP_METER("NCollection_Queue pushing")
132       ////////////////////////////////aNOper.Start();
133       PERF_START_METER("NCollection_Queue operator=")
134       a2 = a1;
135       ////////////////////////////////aNOper.Stop();
136       PERF_STOP_METER("NCollection_Queue operator=")
137       ////////////////////////////////aNAssi.Start();
138       PERF_START_METER("NCollection_Queue Assign")
139       a2.Assign(a1);
140       ////////////////////////////////aNAssi.Stop();
141       PERF_STOP_METER("NCollection_Queue Assign")
142       ////////////////////////////////aNPopp.Start();
143       PERF_START_METER("NCollection_Queue popping")
144       for (j=1; j<=theSize; j++)
145         a1.Pop();
146       ////////////////////////////////aNPopp.Stop();
147       PERF_STOP_METER("NCollection_Queue popping")
148       ////////////////////////////////aNClea.Start();
149       PERF_START_METER("NCollection_Queue clearing")
150       a2.Clear();
151       ////////////////////////////////aNClea.Stop();
152       PERF_STOP_METER("NCollection_Queue clearing")
153     }
154
155   for (i=0; i<theRep; i++)
156     {
157       QANCollection_QueueOfPnt a1, a2;
158       ////////////////////////////////aTPush.Start();
159       PERF_START_METER("TCollection_Queue pushing")
160       for (j=1; j<=theSize; j++)
161         {
162           ItemType anItem;
163           Random(anItem);
164           a1.Push(anItem);
165         }
166       ////////////////////////////////aTPush.Stop();
167       PERF_STOP_METER("TCollection_Queue pushing")
168       ////////////////////////////////aTOper.Start();
169       PERF_START_METER("TCollection_Queue operator=")
170       a2 = a1;
171       ////////////////////////////////aTOper.Stop();
172       PERF_STOP_METER("TCollection_Queue operator=")
173       ////////////////////////////////aTPopp.Start();
174       PERF_START_METER("TCollection_Queue popping")
175       for (j=1; j<=theSize; j++)
176         a1.Pop();
177       ////////////////////////////////aTPopp.Stop();
178       PERF_STOP_METER("TCollection_Queue popping")
179       ////////////////////////////////aTClea.Start();
180       PERF_START_METER("TCollection_Queue clearing")
181       a2.Clear();
182       ////////////////////////////////aTClea.Stop();
183       PERF_STOP_METER("TCollection_Queue clearing")
184     }
185   PERF_PRINT_ALL
186 }
187
188 // ===================== Test perform of Stack type ==========================
189 void CompStack (const Standard_Integer theRep,
190                 const Standard_Integer theSize)
191 {
192   Standard_Integer i,j;
193
194   ////////////////////////////////Perf_Meter aNPush ("NCollection_Stack pushing",0);
195   ////////////////////////////////Perf_Meter aTPush ("TCollection_Stack pushing",0);
196   ////////////////////////////////Perf_Meter aNPopp ("NCollection_Stack popping",0);
197   ////////////////////////////////Perf_Meter aTPopp ("TCollection_Stack popping",0);
198   ////////////////////////////////Perf_Meter aNOper ("NCollection_Stack operator=",0);
199   ////////////////////////////////Perf_Meter aTOper ("TCollection_Stack operator=",0);
200   ////////////////////////////////Perf_Meter aNClea ("NCollection_Stack clearing",0);
201   ////////////////////////////////Perf_Meter aTClea ("TCollection_Stack clearing",0);
202   ////////////////////////////////Perf_Meter aNAssi ("NCollection_Stack Assign",0);
203   for (i=0; i<theRep; i++)
204     {
205       ////////////////////////////////QANCollection_Stack a1, a2;
206       QANCollection_StackPerf a1, a2;
207       ////////////////////////////////aNPush.Start();
208       PERF_START_METER("NCollection_Stack pushing")
209       for (j=1; j<=theSize; j++)
210         {
211           ItemType anItem;
212           Random(anItem);
213           a1.Push(anItem);
214         }
215       ////////////////////////////////aNPush.Stop();
216       PERF_STOP_METER("NCollection_Stack pushing")
217       ////////////////////////////////aNOper.Start();
218       PERF_START_METER("NCollection_Stack operator=")
219       a2 = a1;
220       ////////////////////////////////aNOper.Stop();
221       PERF_STOP_METER("NCollection_Stack operator=")
222       ////////////////////////////////aNAssi.Start();
223       PERF_START_METER("NCollection_Stack Assign")
224       a2.Assign(a1);
225       ////////////////////////////////aNAssi.Stop();
226       PERF_STOP_METER("NCollection_Stack Assign")
227       ////////////////////////////////aNPopp.Start();
228       PERF_START_METER("NCollection_Stack popping")
229       for (j=1; j<=theSize; j++)
230         a1.Pop();
231       ////////////////////////////////aNPopp.Stop();
232       PERF_STOP_METER("NCollection_Stack popping")
233       ////////////////////////////////aNClea.Start();
234       PERF_START_METER("NCollection_Stack clearing")
235       a2.Clear();
236       ////////////////////////////////aNClea.Stop();
237       PERF_STOP_METER("NCollection_Stack clearing")
238     }
239
240   for (i=0; i<theRep; i++)
241     {
242       QANCollection_StackOfPnt a1, a2;
243       ////////////////////////////////aTPush.Start();
244       PERF_START_METER("TCollection_Stack pushing")
245       for (j=1; j<=theSize; j++)
246         {
247           ItemType anItem;
248           Random(anItem);
249           a1.Push(anItem);
250         }
251       ////////////////////////////////aTPush.Stop();
252       PERF_STOP_METER("TCollection_Stack pushing")
253       ////////////////////////////////aTOper.Start();
254       PERF_START_METER("TCollection_Stack operator=")
255       a2 = a1;
256       ////////////////////////////////aTOper.Stop();
257       PERF_STOP_METER("TCollection_Stack operator=")
258       ////////////////////////////////aTPopp.Start();
259       PERF_START_METER("TCollection_Stack popping")
260       for (j=1; j<=theSize; j++)
261         a1.Pop();
262       ////////////////////////////////aTPopp.Stop();
263       PERF_STOP_METER("TCollection_Stack popping")
264       ////////////////////////////////aTClea.Start();
265       PERF_START_METER("TCollection_Stack clearing")
266       a2.Clear();
267       ////////////////////////////////aTClea.Stop();
268       PERF_STOP_METER("TCollection_Stack clearing")
269     }
270   PERF_PRINT_ALL
271 }
272
273
274 // ===================== Test perform of Set type ==========================
275 void CompSet (const Standard_Integer theRep,
276               const Standard_Integer theSize)
277 {
278   Standard_Integer i,j;
279
280   ////////////////////////////////Perf_Meter aNPush ("NCollection_Set pushing",0);
281   ////////////////////////////////Perf_Meter aTPush ("TCollection_Set pushing",0);
282   ////////////////////////////////Perf_Meter aNFind ("NCollection_Set finding",0);
283   ////////////////////////////////Perf_Meter aTFind ("TCollection_Set finding",0);
284   ////////////////////////////////Perf_Meter aNOper ("NCollection_Set operator=",0);
285   ////////////////////////////////Perf_Meter aTOper ("TCollection_Set operator=",0);
286   ////////////////////////////////Perf_Meter aNClea ("NCollection_Set clearing",0);
287   ////////////////////////////////Perf_Meter aTClea ("TCollection_Set clearing",0);
288   ////////////////////////////////Perf_Meter aNAssi ("NCollection_Set Assign",0);
289   for (i=0; i<theRep; i++)
290     {
291       ////////////////////////////////QANCollection_Set a1, a2;
292       QANCollection_SetPerf a1, a2;
293       ////////////////////////////////aNPush.Start();
294       PERF_START_METER("NCollection_Set pushing")
295       for (j=1; j<=theSize; j++)
296         {
297           Key2Type anItem;
298           Random(anItem);
299           a1.Add(anItem);
300         }
301       ////////////////////////////////aNPush.Stop();
302       PERF_STOP_METER("NCollection_Set pushing")
303       ////////////////////////////////aNFind.Start();
304       PERF_START_METER("NCollection_Set finding")
305       for (j=1; j<=theSize; j++)
306         {
307           Key2Type anItem;
308           Random(anItem);
309           a1.Contains(anItem);
310         }
311       ////////////////////////////////aNFind.Stop();
312       PERF_STOP_METER("NCollection_Set finding")
313       ////////////////////////////////aNOper.Start();
314       PERF_START_METER("NCollection_Set operator=")
315       a2 = a1;
316       ////////////////////////////////aNOper.Stop();
317       PERF_STOP_METER("NCollection_Set operator=")
318       ////////////////////////////////aNAssi.Start();
319       PERF_START_METER("NCollection_Set Assign")
320       a2.Assign(a1);
321       ////////////////////////////////aNAssi.Stop();
322       PERF_STOP_METER("NCollection_Set Assign")
323       ////////////////////////////////aNClea.Start();
324       PERF_START_METER("NCollection_Set clearing")
325       a2.Clear();
326       ////////////////////////////////aNClea.Stop();
327       PERF_STOP_METER("NCollection_Set clearing")
328     }
329
330   for (i=0; i<theRep; i++)
331     {
332       TColStd_SetOfInteger a1, a2;
333       ////////////////////////////////aTPush.Start();
334       PERF_START_METER("TCollection_Set pushing")
335       for (j=1; j<=theSize; j++)
336         {
337           Key2Type anItem;
338           Random(anItem);
339           a1.Add(anItem);
340         }
341       ////////////////////////////////aTPush.Stop();
342       PERF_STOP_METER("TCollection_Set pushing")
343       ////////////////////////////////aTFind.Start();
344       PERF_START_METER("TCollection_Set finding")
345         for (j=1; j<=theSize; j++)
346           {
347             Key2Type anItem;
348             Random(anItem);
349             a1.Contains(anItem);
350           }
351       ////////////////////////////////aTFind.Stop();
352       PERF_STOP_METER("TCollection_Set finding")
353       ////////////////////////////////aTOper.Start();
354       PERF_START_METER("TCollection_Set operator=")
355       a2 = a1;
356       ////////////////////////////////aTOper.Stop();
357       PERF_STOP_METER("TCollection_Set operator=")
358       ////////////////////////////////aTClea.Start();
359       PERF_START_METER("TCollection_Set clearing")
360       a2.Clear();
361       ////////////////////////////////aTClea.Stop();
362       PERF_STOP_METER("TCollection_Set clearing")
363     }
364   PERF_PRINT_ALL
365 }
366
367
368 // ===================== Test perform of SList type ==========================
369 void CompSList (const Standard_Integer theRep,
370                 const Standard_Integer theSize)
371 {
372   Standard_Integer i,j;
373
374   ////////////////////////////////Perf_Meter aNAppe ("NCollection_SList constructing",0);
375   ////////////////////////////////Perf_Meter aTAppe ("TCollection_SList constructing",0);
376   ////////////////////////////////Perf_Meter aNOper ("NCollection_SList operator=",0);
377   ////////////////////////////////Perf_Meter aTOper ("TCollection_SList operator=",0);
378   ////////////////////////////////Perf_Meter aNAssi ("NCollection_SList Assign",0);
379   ////////////////////////////////Perf_Meter aNClea ("NCollection_SList clearing",0);
380   ////////////////////////////////Perf_Meter aTClea ("TCollection_SList clearing",0);
381   for (i=0; i<theRep; i++)
382     {
383       ////////////////////////////////QANCollection_SList a1, a2;
384       QANCollection_SListPerf a1, a2;
385       ////////////////////////////////aNAppe.Start();
386       PERF_START_METER("NCollection_SList constructing")
387       for (j=1; j<=theSize; j++)
388       {
389         ItemType anItem;
390         Random(anItem);
391         a1.Construct(anItem);
392       }
393     ////////////////////////////////aNAppe.Stop();
394     PERF_STOP_METER("NCollection_SList constructing")
395     ////////////////////////////////aNOper.Start();
396     PERF_START_METER("NCollection_SList operator=")
397     a2 = a1;
398     ////////////////////////////////aNOper.Stop();
399     PERF_STOP_METER("NCollection_SList operator=")
400     ////////////////////////////////aNAssi.Start();
401     PERF_START_METER("NCollection_SList Assign")
402     a2.Assign(a1);
403     ////////////////////////////////aNAssi.Stop();
404     PERF_STOP_METER("NCollection_SList Assign")
405     ////////////////////////////////aNClea.Start();
406     PERF_START_METER("NCollection_SList clearing")
407     a2.Clear();
408     ////////////////////////////////aNClea.Stop();
409     PERF_STOP_METER("NCollection_SList clearing")
410   }
411
412   for (i=0; i<theRep; i++)
413     {
414       QANCollection_SListOfPnt a1, a2;
415       ////////////////////////////////aTAppe.Start();
416       PERF_START_METER("TCollection_SList constructing")
417       for (j=1; j<=theSize; j++)
418         {
419           ItemType anItem;
420           Random(anItem);
421           a1.Construct(anItem);
422         }
423       ////////////////////////////////aTAppe.Stop();
424       PERF_STOP_METER("TCollection_SList constructing")
425       ////////////////////////////////aTOper.Start();
426       PERF_START_METER("TCollection_SList operator=")
427       a2 = a1;
428       ////////////////////////////////aTOper.Stop();
429       PERF_STOP_METER("TCollection_SList operator=")
430       ////////////////////////////////aTClea.Start();
431       PERF_START_METER("TCollection_SList clearing")
432       a2.Clear();
433       ////////////////////////////////aTClea.Stop();
434       PERF_STOP_METER("TCollection_SList clearing")
435     }
436   PERF_PRINT_ALL
437 }
438
439 // ===================== Test perform of Sequence type ==========================
440 void CompSequence (const Standard_Integer theRep,
441                    const Standard_Integer theSize)
442 {
443   Standard_Integer i,j;
444
445   ////////////////////////////////Perf_Meter aNAppe ("NCollection_Sequence appending",0);
446   ////////////////////////////////Perf_Meter aTAppe ("TCollection_Sequence appending",0);
447   ////////////////////////////////Perf_Meter aNFind ("NCollection_Sequence finding",0);
448   ////////////////////////////////Perf_Meter aTFind ("TCollection_Sequence finding",0);
449   ////////////////////////////////Perf_Meter aNOper ("NCollection_Sequence operator=",0);
450   ////////////////////////////////Perf_Meter aTOper ("TCollection_Sequence operator=",0);
451   ////////////////////////////////Perf_Meter aNClea ("NCollection_Sequence clearing",0);
452   ////////////////////////////////Perf_Meter aTClea ("TCollection_Sequence clearing",0);
453   ////////////////////////////////Perf_Meter aNAssi ("NCollection_Sequence Assign",0);
454   for (i=0; i<theRep; i++)
455     {
456       ////////////////////////////////QANCollection_Sequence a1, a2;
457       QANCollection_SequencePerf a1, a2;
458       ////////////////////////////////aNAppe.Start();
459       PERF_START_METER("NCollection_Sequence appending")
460       for (j=1; j<=theSize; j++)
461         {
462           ItemType anItem;
463           Random(anItem);
464           a1.Append(anItem);
465         }
466       ////////////////////////////////aNAppe.Stop();
467       PERF_STOP_METER("NCollection_Sequence appending")
468       ////////////////////////////////aNFind.Start();
469       PERF_START_METER("NCollection_Sequence finding")
470       for (j=1; j<=theSize; j++)
471         {
472           Standard_Integer iIndex;
473           Random(iIndex,theSize);
474           a1.Value(iIndex+1);
475         }
476       ////////////////////////////////aNFind.Stop();
477       PERF_STOP_METER("NCollection_Sequence finding")
478       ////////////////////////////////aNOper.Start();
479       PERF_START_METER("NCollection_Sequence operator=")
480       a2 = a1;
481       ////////////////////////////////aNOper.Stop();
482       PERF_STOP_METER("NCollection_Sequence operator=")
483       ////////////////////////////////aNAssi.Start();
484       PERF_START_METER("NCollection_Sequence Assign")
485       a2.Assign(a1);
486       ////////////////////////////////aNAssi.Stop();
487       PERF_STOP_METER("NCollection_Sequence Assign")
488       ////////////////////////////////aNClea.Start();
489       PERF_START_METER("NCollection_Sequence clearing")
490       a2.Clear();
491       ////////////////////////////////aNClea.Stop();
492       PERF_STOP_METER("NCollection_Sequence clearing")
493     }
494
495   for (i=0; i<theRep; i++)
496     {
497       TColgp_SequenceOfPnt a1, a2;
498       ////////////////////////////////aTAppe.Start();
499       PERF_START_METER("TCollection_Sequence appending")
500       for (j=1; j<=theSize; j++)
501         {
502           ItemType anItem;
503           Random(anItem);
504           a1.Append(anItem);
505         }
506       ////////////////////////////////aTAppe.Stop();
507       PERF_STOP_METER("TCollection_Sequence appending")
508       ////////////////////////////////aTFind.Start();
509       PERF_START_METER("TCollection_Sequence finding")
510       for (j=1; j<=theSize; j++)
511         {
512           Standard_Integer iIndex;
513           Random(iIndex,theSize);
514           a1.Value(iIndex+1);
515         }
516       ////////////////////////////////aTFind.Stop();
517       PERF_STOP_METER("TCollection_Sequence finding")
518       ////////////////////////////////aTOper.Start();
519       PERF_START_METER("TCollection_Sequence operator=")
520       a2 = a1;
521       ////////////////////////////////aTOper.Stop();
522       PERF_STOP_METER("TCollection_Sequence operator=")
523       ////////////////////////////////aTClea.Start();
524       PERF_START_METER("TCollection_Sequence clearing")
525       a2.Clear();
526       ////////////////////////////////aTClea.Stop();
527       PERF_STOP_METER("TCollection_Sequence clearing")
528     }
529   PERF_PRINT_ALL
530 }
531
532 #endif