Skip to content

Instantly share code, notes, and snippets.

@JeroenVdb
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save JeroenVdb/213603de6c98f895ed8c to your computer and use it in GitHub Desktop.

Select an option

Save JeroenVdb/213603de6c98f895ed8c to your computer and use it in GitHub Desktop.

1. Network

  1. Avoid 301, 302 redirects
  2. Reduce DNS lookups
  3. Reduce the number of HTTP requests
  4. No 404 errors
  • Always have a favicon.ico
  1. DNS Prefetching (?)

2. Caching

  1. Static assets (example: JS, CSS, images): "Never expire" policy by setting far future Expires header
  2. Dynamic assets (webpages): set appropriate cache controle headers
  3. Gzip

Notes

3. HTML

  1. Specify a charcter set (so the browser doesn't have to guess)

4. JS

  1. Concatenate JS assets
  2. Minify JS assets
  3. Uglify JS assets
  4. <script async> in the bottom
  5. Do not include inline JavaScript between external CSS and other resources

Notes

5. CSS

  1. CSS completely on top
  2. Avoid repaint by using only one CSS file and no further inline CSS
  3. Simple CSS rule definition, avoid *, >
  4. Remove unused rules (unsued-css.com) (FF: Dust me selection)
  5. Avoid reflow (making elements bigger)
  6. DON'T use @import. Use multiple elements for async downloading.

Repaint: changing the color of an element. Reflow: changing the size of an element. (test with: --show-paint-rects)

Notes

  • Put essential CSS in the head and async load secondary CSS ?

6. HTTP2 / spdy

  1. Kan meerdere request tegelijk afvuren.
  • Niet meer nodig om alles te concateneren ?

References:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment