The way you write functions and define variables affects your productivity and your application’s performance.
Long scripts take a long time to compile. Break scripts up so that instead of one long script, you have a shorter script that makes calls to several other functions. Consider defining functions in user objects so that other objects can call the same functions.
The scope of variables affects performance. When you have a choice, use local variables, which provide the fastest performance. Global variables have the biggest negative impact on performance.