: . ( , , !)
, , . , , , . . , : int , int, int .
So, when you reduce the scope of local variables, you allow the compiler to reuse more slots in the stack frame. This reduces the overall size of your stack and the distance that the stack grows / shrinks. This, in turn, leads to better cache utilization and therefore better performance.
However, the effect of this effect is negligible, so you should generally ignore it and just write the most readable code you can.
source
share