Global vs local in OnTick()

 
I prefer to declare variables, structures and classes that I use in OnTick() globally (one time), rather than locally within OnTick(). I feel that it is more efficient and less time consuming considering that OnTick() is called so frequently. Yet I see that it is common practice to declare locally. Why is this?
 
TomP3185: I prefer to declare variables, structures and classes that I use in OnTick() globally (one time), rather than locally within OnTick(). I feel that it is more efficient and less time consuming considering that OnTick() is called so frequently. Yet I see that it is common practice to declare locally. Why is this?

Encapsulation and portability of functions.

The contents of globally scoped variables may be altered by other functions. That may be a requirement, but if not, then locally scoped variables offer encapsulation and easier portability of functionality.

EDIT: Do a "Google" search about it, in languages similar to C/C++, to understand the concept better.

 
That's a good explanation, thanks Fernando.
Reason: