Re: [script] Comparing two transforms

Date : Fri, 12 Jan 2007 17:26:08 -0600 (CST)
To : XSI(at)Softimage.COM
From : Joe Laffey <joe(at)laffey.tv>
Subject : Re: [script] Comparing two transforms
On Fri, 12 Jan 2007, Bernard Lebel wrote:

It is indeed much faster.

More interestingly, compare4 is now 3 times faster than than compare1
and compare3. See results below.

Previous scores:

#INFO : compare1 : 0.088
#INFO : compare2 : 1.897
#INFO : compare3 : 0.085
#INFO : compare4 : 1.551

New scores:

#INFO : compare1 : 0.09
#INFO : compare2 : 0.355
#INFO : compare3 : 0.092
#INFO : compare4 : 0.029

[snip]>



def compare4( oT1, oT2, oMatrixA, oMatrixB ):
for i in range(0, 4):
for j in range(0, 4):
if abs( oMatrixA.Value(i, j) - oMatrixB.Value(i,j) )
0.0001:
				return False

return True


Nice!

Now if your are REALLY trying to make things fast, for something so short as 16 elements you could easily unroll the loops into a series of if statements like in the other functions. This avoids the (very slight) overhead of setting up the loop, and reading from / writing to the iterator variables...


-- Joe Laffey | Visual Effects for Film and Video LAFFEY Computer Imaging | ------------------------------------- St. Louis, MO | Show Reel http://LAFFEY.tv/?e04162 USA | ------------------------------------- . | -*- Digital Fusion Plugins -*- -------------------------------------------------------------------------- Mail here will be rejected --> "Real Trap" <r_trap(at)laffeycomputer.com> --- Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body: unsubscribe xsi


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.