Skip to navigation. Skip to content.

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.

Conclusion

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.

Update

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

Tags:

One Response

  1. sascha/hdrs on 27 Nov 2009

    The long variable names are really no big deal performance-wise today anymore.
    The only reason that one still could argue with is that the compiler leaves the names completely intact (except for local vars) in the swf and that you can see them all bare-naked when decompiling the swf.

Leave a Response

(required)
(will not be published) (required)

You can use these XHTML tags:

  • <a href="" title="">
  • <abbr title="">
  • <acronym title="">
  • <b>
  • <blockquote cite="">
  • <cite>
  • <code>
  • <del datetime="">
  • <em>
  • <i>
  • <q cite="">
  • <strike>
  • <strong>

Featured Projects

Commons Identity

Research on the topic of designing brand identity in Open Source projects.

Jajuk Advanced Jukebox

Jajuk is software that organizes and plays music. It is a full-featured application geared towards advanced users with large or scattered music collections.

Back to top.

About

Picture of Nicolas Schudel

I am Nicolas Schudel – a Media Designer who can’t figure out if he’d rather design or code. Like a geeky version of Tintin, I will travel out of my way to investigate new web phenomena. Continue Reading...

Contact

Add my contact information to your address book. Give me a ring on my cell using +41 77 437 78 34, or on Skype using nicolasschudel.

Elsewhere

Find me elsewhere on the web at Delicious, Facebook, LinkedIn, Netvibes, Twitter and XING.