How Descriptive Variable Names Affect a SWF’s File Size

Often I notice in other peoples Actionscript code, that all the variable names are really vague. The programmer’s typing effort is shortened at the cost of readability. Reducing the file size of the final application may be a reason, but the names get compiled into smaller bytecode at the end. I was wondering what the impact is on the file-size of a compiled SWF.

A quick test gave the answer: Practically nill. 30 really long variable names compared to 30 short ones resulted in a file size difference of a measly 5 bytes.


For file size optimization, limiting the length of variable names should be considered an extreme measure. Rather, leave the code readable and optimize the images instead.


Short variable names perform better than long ones. But again, not enough to make it worthwhile throughout the entire application.