Make UglifyJS way faster by using it sooner

  1. Read the many small files
  2. Lump them into a few big files
  3. Minify the big files

Adding Code Compounds Minify Wait Times

  1. It parses a JavaScript file into an Abstract Syntax Tree, or AST. (The AST is the in-memory representation browsers will use when they eventually run the code.)
  2. It modifies the AST without changing logic. Basically: it renames long variables like myTemporaryVariable to t. (There are other techniques that can shorten code a tiny bit more.)
  3. It outputs the AST as tersely as it can. For instance: it prints emptiness instead of comments; it doesn’t print extra spaces; and it writes !0 instead of true to save two bytes.

Breaking The Cache

Minify Sooner

  1. Read the many small files
  2. Minify them, one at a time
  3. Lump them into a few bigger files

Today’s Solutions

--

--

--

Journalist, ex software engineer

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adam Hooper

Adam Hooper

Journalist, ex software engineer

More from Medium

for(… in …) v/s for(… of ..)

How to make multi-language with react-i18next ?

What are WebSockets?

Handling the Fetch Error (404) in JavaScript