Best way to optimize design script?

Currently my dynamo script is taking a very long time to run due to many stages that pass “null” objects,
I am thinking of converting the design script to be activated using a boolean input as a toggle to skip some of the functions if it’s worth doing or not.
other thing is i’m trying to figure out how to use an “if” in the imperative block, can someone help me provide an example of how to use “if” as a toggle and to perform a task like “set parameter value” when true?

There is a node in the springs package called ‘fraction to feet’ (or similar - this is from memory) which is a great example of how design script can run a portion of code in an imperative code block.

3 Likes