Commit 25caf8ff authored by Brad King's avatar Brad King
Browse files

ENH: Speedup for SetupInputs method by not doing a Register/UnRegister and...

ENH: Speedup for SetupInputs method by not doing a Register/UnRegister and AddConsumer/RemoveConsumer pair for inputs that are already present.
parent 8825b292
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "vtkDebugLeaks.h" #include "vtkDebugLeaks.h"
vtkCxxRevisionMacro(vtkProcessObject, "1.45"); vtkCxxRevisionMacro(vtkProcessObject, "1.46");
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
...@@ -639,10 +639,24 @@ void vtkProcessObject::SetupInputs() ...@@ -639,10 +639,24 @@ void vtkProcessObject::SetupInputs()
newInputs[count] = 0; newInputs[count] = 0;
} }
else else
{
// If the data object was already an input, avoid the
// Register/UnRegister cycle.
int found = 0;
for(int j=0; !found && j < this->NumberOfInputs; ++j)
{
if(newInputs[count] == this->Inputs[j])
{
this->Inputs[j] = 0;
found = 1;
}
}
if(!found)
{ {
newInputs[count]->Register(this); newInputs[count]->Register(this);
newInputs[count]->AddConsumer(this); newInputs[count]->AddConsumer(this);
} }
}
++count; ++count;
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment