0031189: Draw Harness, ViewerTest - send messages to Message::DefaultMessenger()
[occt.git] / tests / bugs / vis / bug26029
CommitLineData
d4aaad5b 1puts "============"
2puts "0026029: Visualization - Poor performance of connected objects"
3puts "============"
4puts ""
5###########################################################
6# Time spent on computation of large number of connected objects
7# should grow linearly with the number of objects
8###########################################################
9
10pload MODELING VISUALIZATION
11psphere s 0.5
12tclean s
13incmesh s 0.1
14trinfo s
15
16vinit View1
17vclear
18vaxo
19#vcaps -vbo 0
20vsetdispmode 1
21vdefaults -defl 1.0 -autoTriang off
22vdisplay s
23
d4aaad5b 24set aNb1 100
25
26# display 100x100 connected instances of single presentation
27puts "Creating [expr $aNb1*$aNb1] instances..."
28set t [time {for {set i 0} {$i < $aNb1} {incr i} {for {set j 0} {$j < $aNb1} {incr j} {vconnectto s_${i}_${j} ${i} ${j} 0 s -noupdate}}}]
29set d1 [lindex $t 0]
30puts "Done in $d1 microseconds!\n"
31vclear
32
33set aNb2 200
34
35# display 200x200 connected instances of single presentation
36puts "Creating [expr $aNb2*$aNb2] instances..."
37set t [time {for {set i 0} {$i < $aNb2} {incr i} {for {set j 0} {$j < $aNb2} {incr j} {vconnectto s_${i}_${j} ${i} ${j} 0 s -noupdate}}}]
38set d2 [lindex $t 0]
39puts "Done in $d2 microseconds!\n"
40vclear
41
42# compare two CPU times: the ratio should be quasi-linear
43set expected_ratio [expr double($aNb2 * $aNb2) / double($aNb1 * $aNb1)]
44set actual_ratio [expr double($d2) / double($d1)]
45puts "Comparing CPU time for the two test cases..."
46puts "============================================="
47puts "Expected ratio: $expected_ratio"
48puts "Actual ratio: $actual_ratio"
49puts "============================================="
50
51# Allow 50% deviation from linear growth
52if {[expr $actual_ratio / $expected_ratio] > 1.5} {
53 puts "Error: non-linear time growth detected!"
54} else {
55 puts "Test passed!"
56}