I have a function that does a huge number of iterations. I suspect that the function calls themselves are resulting in overhead. I tried passing by reference instead of by value, but this slowed things down. If I use global variables, this will speed things up at least some, but I'm weary of global variables. I could probably do the whole thing with goto statements, and that would probably be the fastest, but it will be ugly.
My function iterates in a tree-like pattern, but there is no actual tree data structure, so the memory foot print is not overly large.
I have a lot of input variables. I could lump them all into one structure or one class and just pass that single object. I'm not sure if this would actually do anything though.
Is there anything that I should be aware of if I want to optimize a recursive function?