Adjusting testing case
[occt.git] / tests / perf / fclasses / handle
CommitLineData
380eaf77 1puts "TODO OCC26471 Linux: Error: OCCT DownCast is expected to be faster!"
2
e8862cf4 3puts "========"
4puts "CR24023, check operability and performance of OCCT RTTI and handles"
5puts "========"
6puts ""
7
8pload QAcommands
9
10# check RTTI
11QAHandleBool
12QAHandleKind
13QAHandleOps
14
15# check performance of creation and destruction handles, vs. C++ shared_ptr
16set res [QAHandleInc]
17set res_lines [split $res \n]
18set time_occt [lindex [split [lindex $res_lines 1] :] end]
19set time_std [lindex [split [lindex $res_lines 2] :] end]
20set ratio [expr $time_occt / $time_std]
21
22# allow 5% deviation
23if { $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 29set depths {3 5 10 50}
16a24b67 30set threshold_std 4.0
31set threshold_ptr 2.5
e8862cf4 32for {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}