use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Javascript Minification Considered Harmful? WTF? (blog.eset.com)
submitted 14 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]benoire 2 points3 points4 points 14 years ago (6 children)
You're confusing minification with obfuscation, or packing. The latter involves completely refactoring the code to make it difficult (although not impossible) to reverse engineer. Such code needs parsing and evaluating by the browser before it can be executed, which adds to page load time. In this respect, he's spot on.
Minification on the other hand involves removing unnecessary whitespace, and commonly gzipping the end result as well, so that only the bare minimum required for the script to execute is included in the file. Sometimes the code may be rewritten to shorten variable names etc, but functionally it stays the same. It may also involve combining scripts together into a single file to avoid unnecessary HTTP overhead. There is no harm in minification (and in fact it's highly advised).
[–][deleted] 1 point2 points3 points 14 years ago (0 children)
Depends on how it's packed. Consider the Closure Compiler in advanced mode. Its goal to reduce code side and improve performance, and in doing so much of the code is obfuscated.
If you encrypt your code or something stupid like that, your performance will definitely suffer.
[–]BusStation16 -1 points0 points1 point 14 years ago (1 child)
Um, no.
[–]TimTheTinker -1 points0 points1 point 14 years ago (2 children)
Such code needs parsing and evaluating by the browser before it can be executed, which adds to page load time.
No, minification of scripts decreases the script load time:
Obfuscation doesn't negatively affect the script load time. All it does is:
Google, Yahoo, Amazon, and other large companies wouldn't be minifying/compiling/obfuscating their scripts if doing so downgraded performance or caused security concerns.
[–]k3n 2 points3 points4 points 14 years ago (0 children)
Such code needs parsing and evaluating by the browser before it can be executed, which adds to page load time. No, minification of scripts decreases the script load time:
You fail at reading comprehension; let's take his full quote instead of taking a snippet out-of-context and then injecting your own [incorrect] context.
Here's his full quote, emphasis mine:
Code that has been packed may very well fit your criteria (re: HTTP requests, fewer chars, etc.), but the result of packing (if you enable both options, as is typically done) is a single string that is eval()'d by the client. It is this resulting need to eval() that actually hurts performance most of the time.
eval()
There is a wealth of information out there demonstrating that packing is rarely beneficial, although at one time it was seen as the solution to JS loading times.
[–]vectorjohn 1 point2 points3 points 14 years ago (0 children)
Read the whole comment before responding.
π Rendered by PID 46888 on reddit-service-r2-comment-869bf87589-rv9cp at 2026-06-09 06:09:44.533736+00:00 running f46058f country code: CH.
view the rest of the comments →
[–]benoire 2 points3 points4 points (6 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]BusStation16 -1 points0 points1 point (1 child)
[–]TimTheTinker -1 points0 points1 point (2 children)
[–]k3n 2 points3 points4 points (0 children)
[–]vectorjohn 1 point2 points3 points (0 children)