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