Brown Bag Lunch — Getting your Team Passionate About Web Performance to Achieve Performant Web Apps

A presentation at Brown Bag Lunch — Getting your Team Passionate About Web Performance to Achieve Performant Web Apps in February 2020 in Paris, France by Nicolas Goutay

Slide 1

Slide 1

Getting your Team Passionate About Web Performance g to Achieve Performant Web Apps & /phacks

Slide 2

Slide 2

👋 Hi! I am Nicolas Goutay. I work at Theodo, a web consultancy based in Paris, New York & London. I build JS & Python web applications. I run the JAMStack Paris meetup and help organize the WeLoveSpeed conference. You can find me online (Twitter & GitHub) on @phacks. & /phacks

Slide 3

Slide 3

& /phacks

Slide 4

Slide 4

February 2018, 3 Theodo web apps were performant. 🚀🚀🚀 January 2019, 8 Theodo web apps were performant. 🚀🚀🚀🚀🚀🚀🚀🚀 Today, 27 Theodo web apps are performant. 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 & /phacks

Slide 5

Slide 5

The Culture of Web Performance 🏛 Structure & /phacks

Slide 6

Slide 6

The Culture of Web Performance 🏛 Structure 🛠 Tooling & /phacks

Slide 7

Slide 7

The Culture of Web Performance 🏛 Structure 🛠 Tooling 💡 Knowledge & /phacks

Slide 8

Slide 8

🏛 Structure Leveraging Lean methodologies & /phacks

Slide 9

Slide 9

What is Lean? Lean is a systematic method to maximize customer value while minimizing waste. Helped propel Toyota from a small company to the world’s largest automaker in ~50 years. Its roots trace back to manufacturing, but it can be applied to any industry, including digital product crafting. & /phacks

Slide 10

Slide 10

Identifying the Value Stream In Lean, the Value Stream is a representation of all the value-added steps in the process to go from the raw materials to the finished product. It helps you understand and visualize the whole process, so that you can easily see waste and fight it. In Web Perf, the Value Stream would be all the steps for a website to go from the initial user request to it being interactive. & /phacks

Slide 11

Slide 11

Identifying the Value Stream We mapped the Value Stream, from backend to frontend and back again, and set out to determine maximum durations at every step. & /phacks

Slide 12

Slide 12

Identifying the Value Stream & /phacks

Slide 13

Slide 13

Identifying the Value Stream ⏱ ✅ ⏱ ⏱ Cache C ❌ ✅ : P a e & /phacks

Slide 14

Slide 14

Identifying the Value Stream 👀 Forces to look at the whole process, not only frontend/ backend ⏱ Setting standard times meant that teams asked for help much sooner, and it was easier and faster to help them 💵 Great format to communicate with stakeholders and get buy-in, as it makes “tech stuff” much more tangible & /phacks

Slide 15

Slide 15

Jidoka: catch problems at the earliest 🛑 In Toyota factories, whenever a defect is spotted on the assembly line, the operator stops the whole line to try and fix the defect instead of passing it down the line. 🛠 Then, the process is refined to make sure that it prevents that defect from happening again. & /phacks

Slide 16

Slide 16

Jidoka: catch problems at the earliest In the IDE We use the Import Cost VSCode extension to detect heavy libraries when we add them to our code. & /phacks

Slide 17

Slide 17

Jidoka: catch problems at the earliest In the command line: We spot avoidable library duplication in bundles using yarn.lock information Runs automatically on yarn or yarn add & /phacks

Slide 18

Slide 18

Jidoka: catch problems at the earliest In the CI We check on each PR if the bundle size of our web site is under a certain threshold (here, 500Kb). & /phacks

Slide 19

Slide 19

Jidoka: catch problems at the earliest Finding the right threshold: Find your users’ average network speed, verify them & use this handmade, organic & gluten-free Performance Budget Calculator & /phacks

Slide 20

Slide 20

🛠 Tooling The Tools of the Trade & /phacks

Slide 21

Slide 21

Little-known Chrome Dev Tools for Web Perf 🎨 Coverage: Real-time CSS & JS code coverage. 💡 Helpful for: detecting unused libraries or dead code. & /phacks

Slide 22

Slide 22

Little-known Chrome Dev Tools for Web Perf 🎨 Paint Flashing: Highlight in green the parts of the UI that has been painted by Chrome. 💡 Helpful for: detecting useless renders slowing down the UI. & /phacks

Slide 23

Slide 23

Why Did You Render? ❓ why-did-you-render: Displays a warning in the Chrome console when a React makes unnecessary updates 💡 Helpful for: detecting useless renders slowing down the UI. & /phacks

Slide 24

Slide 24

Keeping it small 📦 bundlesize: CI-friendly bundle size checker. 💡 Helpful for: detecting if your JS goes over a certain threshold & /phacks

Slide 25

Slide 25

Keeping it small 😱 Bundlephobia: Find the cost of adding a NPM package to your bundle. 💡 Helpful for: Deciding between two libraries with similar functionalities. & /phacks

Slide 26

Slide 26

Keeping an eye on performance 📈 Falco: Theodo’s Open Source WebPageTest runner & /phacks

Slide 27

Slide 27

💡 Knowledge Knowledge is power, Sharing is better & /phacks

Slide 28

Slide 28

Share your discoveries! 📆 Weekly Perf: Every week, we have a 1h informal meeting about performance, where we share new libraries, articles, and tackle specific problems on a project. 📣 Dedicated channel: On your company’s social network (Slack, Workplace…), set up a channel dedicated to all things Web Perf. 📈 Dedicated training : I help run a 4-week WebPerformance cursus, 1 hour every Monday, so that all developers can learn the basics and apply them to their projects & /phacks

Slide 29

Slide 29

Best resources to get started 💻 web.dev: Online Lighthouse audit; lots of tutorials to implement performance best practices with interactive exercises & /phacks

Slide 30

Slide 30

Best resources to get started 📖 HPBN High Performance Browser Networking — a free e-book teaching deep understanding of how browsers & Web protocols work, so that you can get the most of them & /phacks

Slide 31

Slide 31

🙏 Thanks! & /phacks

Slide 32

Slide 32

Slides Available at: https://noti.st/phacks Sources My article in Planet Lean: https://planet-lean.com/doubling-performant-appsusing-kaizen/ Import Cost VSCode extension: https://github.com/wix/import-cost Yarn tools to list duplicates: https://gist.github.com/phacks/ 6878465820605e6c2946f034f70f662c Performance Budget Calculator: https://docs.google.com/spreadsheets/d/ 1X7RTp0cQbuSTAlNDO7K-Ln5V4i3iwmWAO0Cndgs4ulw/edit?usp=sharing Bundlesize: https://github.com/siddharthkp/bundlesize Bundlephobia: https://bundlephobia.com Why Did You Render?: https://github.com/welldone-software/why-did-you-render Web.dev: https://web.dev/learn HPBN: https://hpbn.co/ Falco: https://getfal.co/ & /phacks