BigRoyNL

02 February 2011, 10:35 PM

Hey Guys,

I've been wanting to check out speed differences between nodes to speed up my autorigger just every tiny bit extra. But I just couldn't seem to find out which exactly of these two nodes was the fastest and came up with the following way to test it.

Testing the multDoubleLinear node speed:

// testing multDoubleLinear

file -f -new;

shadingNode -asUtility multDoubleLinear;

setAttr "multDoubleLinear1.input1" 1;

setAttr "multDoubleLinear1.input2" 1;

for ($x = 2; $x < 10000; $x++) {

shadingNode -asUtility multDoubleLinear;

connectAttr -f ("multDoubleLinear"+($x-1)+".output") ("multDoubleLinear"+$x+".input1");

setAttr ("multDoubleLinear"+$x+".input2") 2;

select -r ("multDoubleLinear"+$x);

}

{

int $amountOfRepetitions = 20;

int $amountOfFrames = 10000;

float $timings[];

float $total = 0;

for ($x = 0; $x<$amountOfRepetitions ; $x++) {

timer -s;

for ($i = 0 ; $i<$amountOfFrames ; $i++) {

if (`getAttr "multDoubleLinear1.input1"` == 2) {

setAttr "multDoubleLinear1.input1" 2;

}

else {

setAttr "multDoubleLinear1.input1" 1;

}

}

$timer = `timer -e`;

print ($timer+"\n");

$total = $total + $timer;

}

print ("Total time: "+$total+"\nAverage Time: "+($total/$amountOfRepetitions)+"\nFPS: "+(($amountOfRepetitions*$amountOfFrames)/$total)+"\n");

}

Testing the multiplyDivide node speed:

// testing multiplyDivide speed

file -f -new;

shadingNode -asUtility multiplyDivide;

setAttr " multiplyDivide1.input1X" 1;

setAttr " multiplyDivide1.input2X" 1;

for ($x = 2; $x < 10000; $x++) {

shadingNode -asUtility multiplyDivide;

connectAttr -f (" multiplyDivide"+($x-1)+".outputX") (" multiplyDivide"+$x+".input1X");

setAttr ("multiplyDivide"+$x+".input2X") 2;

select -r (" multiplyDivide"+$x);

}

{

int $amountOfRepetitions = 20;

int $amountOfFrames = 10000;

float $timings[];

float $total = 0;

for ($x = 0; $x<$amountOfRepetitions ; $x++) {

timer -s;

for ($i = 0 ; $i<$amountOfFrames ; $i++) {

if (`getAttr " multiplyDivide1.input1X"` == 2) {

setAttr " multiplyDivide1.input1X" 2;

}

else {

setAttr " multiplyDivide1.input1X" 3;

}

}

$timer = `timer -e`;

print ($timer+"\n");

$total = $total + $timer;

}

print ("Total time: "+$total+"\nAverage Time: "+($total/$amountOfRepetitions)+"\nFPS: "+(($amountOfRepetitions*$amountOfFrames)/$total)+"\n");

}

Giving me the results (on both 10.000 nodes and 10.000 calculations on these connected nodes)

The total time is the result of these calculations above done 20 times. The average is for what I said above.

multDoubleLinear

Total time: 7.472

Average Time: 0.3736

FPS: 26766.59529

multiplyDivide

Total time: 10.125

Average Time: 0.50625

FPS: 19753.08642

Oh yeah, the speed difference thus is 0,0000000013 second if you'd just use one for one calculation. :)

So. After I did this. I concluded that the multDoubleLinear would in the end be faster (not noticeably really, but interesting result.)

But I was wondering if it's indeed right to look at these results, if not: What am I doing wrong? And how can I found out which nodes would be faster for my rig and or for what I'm trying to achieve. How can I test this.

Hope somebody knows about this. :)

Thanks in advance.

Bye,

Roy Nieterau

I've been wanting to check out speed differences between nodes to speed up my autorigger just every tiny bit extra. But I just couldn't seem to find out which exactly of these two nodes was the fastest and came up with the following way to test it.

Testing the multDoubleLinear node speed:

// testing multDoubleLinear

file -f -new;

shadingNode -asUtility multDoubleLinear;

setAttr "multDoubleLinear1.input1" 1;

setAttr "multDoubleLinear1.input2" 1;

for ($x = 2; $x < 10000; $x++) {

shadingNode -asUtility multDoubleLinear;

connectAttr -f ("multDoubleLinear"+($x-1)+".output") ("multDoubleLinear"+$x+".input1");

setAttr ("multDoubleLinear"+$x+".input2") 2;

select -r ("multDoubleLinear"+$x);

}

{

int $amountOfRepetitions = 20;

int $amountOfFrames = 10000;

float $timings[];

float $total = 0;

for ($x = 0; $x<$amountOfRepetitions ; $x++) {

timer -s;

for ($i = 0 ; $i<$amountOfFrames ; $i++) {

if (`getAttr "multDoubleLinear1.input1"` == 2) {

setAttr "multDoubleLinear1.input1" 2;

}

else {

setAttr "multDoubleLinear1.input1" 1;

}

}

$timer = `timer -e`;

print ($timer+"\n");

$total = $total + $timer;

}

print ("Total time: "+$total+"\nAverage Time: "+($total/$amountOfRepetitions)+"\nFPS: "+(($amountOfRepetitions*$amountOfFrames)/$total)+"\n");

}

Testing the multiplyDivide node speed:

// testing multiplyDivide speed

file -f -new;

shadingNode -asUtility multiplyDivide;

setAttr " multiplyDivide1.input1X" 1;

setAttr " multiplyDivide1.input2X" 1;

for ($x = 2; $x < 10000; $x++) {

shadingNode -asUtility multiplyDivide;

connectAttr -f (" multiplyDivide"+($x-1)+".outputX") (" multiplyDivide"+$x+".input1X");

setAttr ("multiplyDivide"+$x+".input2X") 2;

select -r (" multiplyDivide"+$x);

}

{

int $amountOfRepetitions = 20;

int $amountOfFrames = 10000;

float $timings[];

float $total = 0;

for ($x = 0; $x<$amountOfRepetitions ; $x++) {

timer -s;

for ($i = 0 ; $i<$amountOfFrames ; $i++) {

if (`getAttr " multiplyDivide1.input1X"` == 2) {

setAttr " multiplyDivide1.input1X" 2;

}

else {

setAttr " multiplyDivide1.input1X" 3;

}

}

$timer = `timer -e`;

print ($timer+"\n");

$total = $total + $timer;

}

print ("Total time: "+$total+"\nAverage Time: "+($total/$amountOfRepetitions)+"\nFPS: "+(($amountOfRepetitions*$amountOfFrames)/$total)+"\n");

}

Giving me the results (on both 10.000 nodes and 10.000 calculations on these connected nodes)

The total time is the result of these calculations above done 20 times. The average is for what I said above.

multDoubleLinear

Total time: 7.472

Average Time: 0.3736

FPS: 26766.59529

multiplyDivide

Total time: 10.125

Average Time: 0.50625

FPS: 19753.08642

Oh yeah, the speed difference thus is 0,0000000013 second if you'd just use one for one calculation. :)

So. After I did this. I concluded that the multDoubleLinear would in the end be faster (not noticeably really, but interesting result.)

But I was wondering if it's indeed right to look at these results, if not: What am I doing wrong? And how can I found out which nodes would be faster for my rig and or for what I'm trying to achieve. How can I test this.

Hope somebody knows about this. :)

Thanks in advance.

Bye,

Roy Nieterau