380eaf77 |
1 | puts "TODO OCC26471 Linux: Error: OCCT DownCast is expected to be faster!" |
d1a67b9d |
2 | puts "TODO OCC24023 ALL: Checking local reference of handle to base type to temporary handle object" |
380eaf77 |
3 | |
e8862cf4 |
4 | puts "========" |
5 | puts "CR24023, check operability and performance of OCCT RTTI and handles" |
6 | puts "========" |
7 | puts "" |
8 | |
9 | pload QAcommands |
10 | |
11 | # check RTTI |
12 | QAHandleBool |
13 | QAHandleKind |
14 | QAHandleOps |
15 | |
16 | # check performance of creation and destruction handles, vs. C++ shared_ptr |
17 | set res [QAHandleInc] |
18 | set res_lines [split $res \n] |
19 | set time_occt [lindex [split [lindex $res_lines 1] :] end] |
20 | set time_std [lindex [split [lindex $res_lines 2] :] end] |
21 | set ratio [expr $time_occt / $time_std] |
22 | |
23 | # allow 5% deviation |
24 | if { $ratio > 1.05 } { |
25 | puts "Error: OCCT handle is too slow: $time_occt vs. $time_std of shared_ptr" |
26 | } |
27 | |
28 | # Check performance of down casting at different nesting depths. |
1c29294e |
29 | # OCCT is expected to be the same as C++ |
e8862cf4 |
30 | set depths {3 5 10 50} |
16a24b67 |
31 | set threshold_std 4.0 |
32 | set threshold_ptr 2.5 |
e8862cf4 |
33 | for {set i 0} {$i < [llength $depths]} {incr i} { |
34 | set depth [lindex $depths $i] |
e8862cf4 |
35 | puts "\nTesting DownCast at nesting depth $depth" |
36 | |
37 | set res [QAHandleCast $depth 0 100000] |
38 | set res_lines [split $res \n] |
1c29294e |
39 | set time_occt [lindex [lindex [split [lindex $res_lines end-2] :] end] end] |
40 | set time_std [lindex [lindex [split [lindex $res_lines end-1] :] end] end] |
41 | set time_ptr [lindex [lindex [split [lindex $res_lines end ] :] end] end] |
e8862cf4 |
42 | set ratio_std [expr $time_occt / $time_std] |
43 | set ratio_ptr [expr $time_occt / $time_ptr] |
44 | |
45 | puts "Ratio of time of OCCT DownCast() to dynamic_cast<>: $ratio_std" |
46 | puts "Ratio of time of OCCT DownCast() to dynamic_pointer_cast<>: $ratio_ptr" |
47 | |
1c29294e |
48 | if { $ratio_std > $threshold_std || $ratio_ptr > $threshold_ptr } { |
380eaf77 |
49 | puts "Error: OCCT DownCast is expected to be faster!" |
e8862cf4 |
50 | } |
51 | } |