Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is a good thing to raise awareness of, but the solution is poor advice.

Asking developers to remember the "gotcha" of 600 characters is not really viable. Instead, if this is important to you, consider the addition of minification or comment stripping to your production deployment process. Minification will also make the variable names and syntax use shorter, saving you further precious characters.

Learn the problem, but automate the solution.



In the context of the article being on nodejs code; I don't know about other developers, but I don't minify my production nodejs code because it runs directly on the server. Whether I have `var nameThatIsStupidlyLong` or `var nTISL` doesn't make a difference because size of code isn't a concern.

What do other developers out there do?


Yeah, but the whole point of the article is that the names of your variables (and even your comments!!) do make a difference in performance.


In this one context, this one micro-optimization applies but for 99% of other cases, they don't (and shouldn't).

Note the 'benchmark' in OP is run 500 million times to see the performance difference. This is definitely not a common scenario.


For me, it's more the principle of the thing. This just seems like an insane way for an interpreter to behave. Even more insane is the proposal of minifying server-side JS!


Not that insane considering many people are using things like Babel to run ES6/7 code. If you're already compiling that code to ES5 for production, there's no harm in also minifying things.


I use https://babeljs.io/ to compile es6 code for production. It could support this kind of transformation though I'm not sure if it does by default.


Babel doesn't, by default.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: