Could the runtime of methods within a system potentially be reduced via refactoring during development (pre-public release)?
i.e. Let's assume that
methodX() takes 2 seconds to complete without having been refactored. It has been discovered that
methodX() is suffering from severe code smells. After refactoring (for example, such as using global variables where appropriate or reducing the parameter list for
methodX() potentially run faster (i.e. to 0.5 seconds, for example)?
Could the speed of the method potentially be increased if refactoring (i.e. eradication of code smells such as using global variables instead of creating
x amount of individual variables, etc) has been applied?
A few of you have provided some good answers, but unfortunately appear to be somewhat missing the point.
I am fully aware that the system's speed could be improved by changing the algorithm used; however, my question is not focussed on this and is more focussed on whether or not refactoring alone could potentially speed up the system (i.e. splitting up large methods/classes, reducing parameter lists, using static and/or global variables, addressing unreachable code (i.e. removing it altogether if it isn't serving a purpose or making it "reachable"), etc).