First, transferring variables to global variables does not directly improve CPU utilization. The initialization of the stack is usually a single addition / subtraction at the entrance / exit of the function, regardless of the size of the frame frame.
However, if a function requires a very large working set, it is better to put it on something other than a stack; stack size is usually limited. The usual choice is a bunch; however, it takes time to set aside and free, and therefore, if you often call this feature, it can be expensive. This is also a problem in embedded systems where they may not have the correct heap implementation.
So, if a bunch is a problem, global solutions may be a solution. However, they have their own drawbacks - in particular, you do not want several threads connected with global data to be executed at the same time, and you cannot execute this function without great care, otherwise recursive bits may damage previous function calls.
So, this is a method that in some cases can be useful. However, I would not recommend using it as a first choice due to threading issues.
Also, for what it's worth, you can get the same memory effects with static variables. I would recommend using them instead, as otherwise you will end up polluting the global namespace.
source share