Optimize clone creation (clones)?

I need to create an instance of a component and the instance should clone the component’s master definition.
So in a script, I currently copy “/foo_def” to “/network/foo” and then set “/network/foo” to clone “/foo_def”

Is there anything I can do optimize this?

For example, would it be faster to first opadd a container “foo” into “/network” and then set the clonestring?
Then I wouldn’t need the copy step (but I would need to match all container level parameters, which might render any time savings useless)

Or maybe have the clonestring already set (but it would point to itself: “/foo_def” clones “/foo_def”)? Then I could copy without setting the clonestring.

Or is the “do I need to update to my master” check performed in clones so fast that I can keep the current copy + setCloneString approach?

Thanks

I see the problem but ya there isn’t a perfect solution. The best one is to do an opadd and then match the top level parameters.

The opcp solutions will result in the entire network getting copied, and then deleted and recreated when the cloning takes hold.

thanks Malcolm.

What’s the fastest way to match the top level parameters of two operators?

Honestly I don’t know. I’d have to make a test case and profile it.