I\'m working on a massive number crunching project. I\'ve been optimising everything since the start as I knew it would be important. Doing performance anal
Just some code rewrite. It might help because it avoids at least two jumps.
public ScTreeNode GetNodeForState(int rootIndex, float[] inputs)
{
ScTreeNode node = RootNodes[rootIndex].TreeNode;
while (node.BranchData != null)
{
BranchNodeData b = node.BranchData;
node = b.Child2;
if (inputs[b.SplitInputIndex] <= b.SplitValue))
node = b.Child1;
}
return node;
}