I have quite a large number of recipes in CASE form that I'm writing in structured text. I'm hoping to keep things clean and efficient when looking at the sum of all the code I am writing.
So my question is when it comes to computation time and program size, which is better
y = x * 3
or
y = x + x + x
This is a rather basic example and I'm sure the processor handles multiplication like multiple additions but curious if someone with better understanding can weigh in.
I've already declared some of the more common multiples outside of the Case structure, so I can just reference those tags rather than compute them for each recipe. Since I do a check of all recipes for best fit, I'd like the search to be as fast as possible.
So my question is when it comes to computation time and program size, which is better
y = x * 3
or
y = x + x + x
This is a rather basic example and I'm sure the processor handles multiplication like multiple additions but curious if someone with better understanding can weigh in.
I've already declared some of the more common multiples outside of the Case structure, so I can just reference those tags rather than compute them for each recipe. Since I do a check of all recipes for best fit, I'd like the search to be as fast as possible.