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