// This file tests timing differences in vector math vs. iterative // calculations. size = million a = new array[size] b = new array[size] for i = 1 to size { a.push[randomFloat[1,1000]] b.push[randomFloat[1,1000]] } println["Done generating."] for iter = 1 to 10 { d = new array s = now[] for i=0 to size-1 d@i = a@i * b@i e = now[] println["Iterative multiply time:\t" + format[e-s, "s", 3]] s = now[] c = mul[a,b] e = now[] println["Vector multiply time: \t" + format[e-s, "s", 3]] if d != c println["***Mismatch!"] }