GithubHelp home page GithubHelp logo

advanced-react-perf's Introduction

Jason Lengstorf has a lot of ideas.

Hi. I’m Jason. I build lots of demos on this account and the @learnwithjason organization. Most of them are built live on Learn With Jason, a live-streamed pair programming show where super smart people join to teach us something new in 90 minutes.

I help dev tooling companies tell better stories and build stronger communities through creative media and strategy consulting. For more information about me (and a whole lot of shenanigans), check out jason.energy.

I have been booped on the nose 41 times.

You can boop my nose by running npx boop-jasons-nose. (I built this with @gr2m on an episode of Learn With Jason.)

advanced-react-perf's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

advanced-react-perf's Issues

Create a branch per section

We need to step through the optimizations on master and apply them to unoptimized-start in sequence.

Notes on the sequence:

  • Start with a mess

// Part 1: low-hanging fruit

  • Run the bundle analyzer
  • Turn on production builds for webpack
  • Add terser
  • Extract CSS
  • Minify CSS
  • Set browser targets for Babel (@babel/preset-env)
  • Enable gzip compression

// Part 2: set up code splitting

  • lazy load large deps (the Prettier + plugins setup)
  • lazy load routes and large components (React.lazy + Suspense)
  • add chunk names for easier debugging

// Part 3: refactor giant deps

  • move Prettier to admin dashboard vs. loading on the client side
  • refactor Moment.js to use date-fns

to mention: lodash vs. lodash-es

// Part 4: optimize font loading

  • switch from @import to <link /> for Google fonts
  • add font-display: swap for local fonts (Fira Code)

// Part 5: add a Service Worker

  • set up workbox
  • load the SW in index.html

at this point, all the bundles will be preloaded, and that’s ~1.5MB

  • ignore vendor bundles
  • set up runtime caching for vendor bundles
  • add runtime caching for Google Fonts

// Part 6: show things as loaded instead of blocking on the slowest thing

  • refactor the dashboard to load metrics inside the chart
  • use Suspense to load the chart

// Part 7: optimize images

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.