Jump to content
muskee

Performance question with scripts

Recommended Posts

Is it better to have 1 long script with 5 different if statements or 5 different scripts?

(the 5 scripts would be assigned to 5 different buttons, the long script would be assigned to every single button)

Share this post


Link to post
Share on other sites

Some more details would be useful, esp. regarding the condition that the 5 If statements are supposed to enforce. I suspect a single script could be written without requiring multiple Ifs. In any case, the difference in performance will be most likely negligible.

Share this post


Link to post
Share on other sites

The purpose of the if statement is to see on what layout the user is in. Based on the layout then I do an export  of the data found on said layout.
I can do this with 5 different scripts or one long script, which way would you prefer? or maybe not necessarily with an if statement?

Share this post


Link to post
Share on other sites

How different is the export process for each layout? In other words, how much of the single-long-script version would live inside the If...Else If...Else branches vs. how much would be the same steps (configured the same way) running outside the If[] block? The more steps in common, the more sense it makes to have the one long script. The more different steps there are, the more it makes sense to have separate smaller scripts.

There's also another option for how to break up the logic which might be worth considering: one script for each layout, and each of those scripts calls common sub-scripts for substantial chunks of steps that are exactly the same. I lean towards this approach when there are both large chunks of logic different between contexts, AND large chunks of logic in common.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

By using this site, you agree to our Terms of Use.