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 | |
d4aaad5b |
24 | set aNb1 100 |
25 | |
26 | # display 100x100 connected instances of single presentation |
27 | puts "Creating [expr $aNb1*$aNb1] instances..." |
28 | 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}}}] |
29 | set d1 [lindex $t 0] |
30 | puts "Done in $d1 microseconds!\n" |
31 | vclear |
32 | |
33 | set aNb2 200 |
34 | |
35 | # display 200x200 connected instances of single presentation |
36 | puts "Creating [expr $aNb2*$aNb2] instances..." |
37 | 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}}}] |
38 | set d2 [lindex $t 0] |
39 | puts "Done in $d2 microseconds!\n" |
40 | vclear |
41 | |
42 | # compare two CPU times: the ratio should be quasi-linear |
43 | set expected_ratio [expr double($aNb2 * $aNb2) / double($aNb1 * $aNb1)] |
44 | set actual_ratio [expr double($d2) / double($d1)] |
45 | puts "Comparing CPU time for the two test cases..." |
46 | puts "=============================================" |
47 | puts "Expected ratio: $expected_ratio" |
48 | puts "Actual ratio: $actual_ratio" |
49 | puts "=============================================" |
50 | |
51 | # Allow 50% deviation from linear growth |
52 | if {[expr $actual_ratio / $expected_ratio] > 1.5} { |
53 | puts "Error: non-linear time growth detected!" |
54 | } else { |
55 | puts "Test passed!" |
56 | } |