Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Designing High Performance React Applications

Designing High Performance React Applications

Sendil Kumar N

June 01, 2022
Tweet

More Decks by Sendil Kumar N

Other Decks in Programming

Transcript

  1. @sendilkumarn @sendilkumarn GET /home TTFB FCP GET /main.js Render (App)

    LCP TTI Time To First Byte First Contentful Paint Largest Contentful Paint Time To Interactivity
  2. @sendilkumarn @sendilkumarn Agenda Obvious - Things that you know already!

    Rendering - Render based on your needs It depends - It actually depends on your usecase Common - Use it everywhere
  3. @sendilkumarn @sendilkumarn GET /home GET /main.js Render (App) Browser has

    to wait until the main.js is downloaded fully. Smaller the size better the performance
  4. @sendilkumarn @sendilkumarn 100 - 170 KB is the ideal size

    for the JavaScript size Budget JavaScript
  5. @sendilkumarn @sendilkumarn 👍 Fast Time To First Byte 👍 Good

    for static content 👎 Performance depends on the client 👎 TTI is high 👎 Bundle size decreases your site performance
  6. @sendilkumarn @sendilkumarn 👍 Fast TTI 👍 Good for dynamic content

    👍 Performance doesn’t depend on the client 👎 TTFB is high 👎 High server cost
  7. @sendilkumarn @sendilkumarn <Layout> <Header /> <Sidebar /> <Main> <Post />

    <Comments /> </Main> <Footer /> </Layout> Server Side Render
  8. @sendilkumarn @sendilkumarn <Layout> <Header /> <Sidebar /> <Main> <Post />

    <Comments /> </Main> <Footer /> </Layout> fetchPosts().then(post => { fetchCommentForPost(…) });
  9. @sendilkumarn @sendilkumarn <Layout> <Header /> <Sidebar /> <Main> <Post />

    <Suspense> <Comments /> </Suspense> </Main> <Footer /> </Layout> fetchPosts(); fetchCommentsForPost();
  10. @sendilkumarn @sendilkumarn blog.js 229 kb 954 kb 32 kb 1215

    kb Calling DB from the client Calculates them on the client
  11. @sendilkumarn @sendilkumarn 👍 No huge dependencies 👍 Props are allowed

    👍 Can import *.client.js 👎 No interactivity 👎 No State / user events
  12. @sendilkumarn @sendilkumarn <img src=“image.png” loading=“lazy” alt=“…” /> <img src=“image.png” alt=“…”

    /> <img src=“image.png” loading=“eager” alt=“…” /> <img src=“image.png” loading=“auto” alt=“…” />
  13. @sendilkumarn @sendilkumarn ChromeVille DNS Land Web World DataVille Folderz hAPPy

    Load HTML HTML JS CSS Parse CSS & JS Waits to fi nish download Parse & Execute Critical @sendilkumarn
  14. @sendilkumarn @sendilkumarn ChromeVille DNS Land Web World DataVille Folderz hAPPy

    HTML JS CSS Load HTML Parse CSS & JS Waits to fi nish download Parse & Execute APIs @sendilkumarn
  15. @sendilkumarn @sendilkumarn ChromeVille DNS Land Web World DataVille Folderz hAPPy

    HTML JS CSS Load HTML Parse CSS & JS Waits to fi nish download Parse & Execute APIs SSR @sendilkumarn