It seems like, for many javascript widgets, the authors have made a conscious effort to use tiny variable names. For example:
// Instead of...
this.mousePositions = new Array();
// they use...
this.mp = new Array();
My question is this: how important is this in terms of reducing overall javascript file request size? I'm working on releasing a javascript widget to the public, which, after being minified, is about 2.8KB. However, because the main advantage of this plugin is how lightweight it is, does anyone have experience with whether it's worth it to go through and switch out all of the sensical variable names that I used with these new, tiny variable names? It just seems like the code is so much less readable that way and it's going to be much harder to maintain.
Thanks for your help!
Charlie
How important? not really unless they're used all over the place, delivering your scripts via gzip compression negates most of the name byte-cost there.
But why not have the best of both words? Use descriptive names when developing (why punish yourself?), then minify your scripts as part of the build process to get small compact names for production code, and a minimal-size transfer to the user.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With