Hi.
I have a program where I have a for loop that uses a “switch case” within it, with a few cases to run different code. Also, I use “ifs” and “else ifs”. But, my code seems to run more than ten times slower with this within the loop, rather than outside the loop. So, I tried a “switch” with only one case to see how it handled, and it took about the same about of time as 20 or so cases, and this seemed odd to me. Also, it runs normal with an “if” statement, but whenever I add any “else ifs” within the loop, it slows down significantly.
Is this because I am running a macro within the root interpereter, rather than compiling with the root libraries, or is this a general problem? I figured that “switch cases” and “else ifs” would not slow down the loop much at all since the execution would simply jump to another location, and it wouldn’t have to do any additional calculation. Or, should I just keep my code how I have it now where I do the “switches” and “ifs” BEFORE the loop, and then loop?
Thank you for the help.
Corey