How can I test the speed of my scripts? I’ve been able to make several solutions to the same problem, but I’m wondering which script is faster. Thanks in advance!
Edit: Here's the code i want to compare. I'm matching a child's transforms to its parent.
Option 1 - Command Model
MatchTransform(child, parent, siSRT);
Option 2 - Object Model
function ffMatchParent(oChild){
var h = oChild.kinematics.local;
h.sclx.value = 1;
h.scly.value = 1;
h.sclz.value = 1;
h.rotx.value = 0;
h.roty.value = 0;
h.rotz.value = 0;
h.posx.value = 0;
h.posy.value = 0;
h.posz.value = 0;
}
//another variation, just shorter, and uses transforms
function fMatchParent(oChild){
oNewLocalTransform = XSIMath.CreateTransform();
oNewLocalTransform.SetTranslationFromValues(0, 0, 0);
oNewLocalTransform.SetRotationFromXYZAnglesValues(0, 0, 0);
oNewLocalTransform.SetScalingFromValues(1, 1, 1);
oChild.Kinematics.Local.Transform = oNewLocalTransform;
}
Option 3 - Object Model - Enumerated
function fMatchParent(oChild){
var oParams = oChild.Kinematics.Local.Parameters;
var oLocal = oChild.Kinematics.Local;
var e = new Enumerator( oParams );
var n = 0;
for (;!e.atEnd();e.moveNext()){
//trace("{ "+ n +" }" + e.item());if(n == 2){trace(e.item(n));}
switch(n){
case 2:
e.item().value = 0;
break;
case 3:
e.item().value = 0;
break;
case 4:
e.item().value = 0;
break;
case 5:
e.item().value = 0;
break;
case 6:
e.item().value = 0;
break;
case 7:
e.item().value = 0;
break;
case 12:
e.item().value = 1;
break;
case 13:
e.item().value = 1;
break;
case 14:
e.item().value = 1;
break;
default:
break;
}
n++
}
}