Getting your Team Passionate About Web Performance to Achieve Performant Web Apps

A presentation at FrontEnd Connect in December 2018 in Warsaw, Poland 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 & London. I build JS & Python web applications. I have stage fright am excited to be here with all of you ☺ You can find me online (Twitter & GitHub) on @phacks. & /phacks

Slide 3

Slide 3

& /phacks

Slide 4

Slide 4

Last February, 3 Theodo web apps were performant. πŸš€πŸš€πŸš€ & /phacks

Slide 5

Slide 5

Last February, 3 Theodo web apps were performant. πŸš€πŸš€πŸš€ Last June, 8 Theodo web apps were performant. πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€ & /phacks

Slide 6

Slide 6

Last February, 3 Theodo web apps were performant. πŸš€πŸš€πŸš€ Last June, 8 Theodo web apps were performant. πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€ Today, 12 Theodo web apps are performant. πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€ & /phacks

Slide 7

Slide 7

The Culture of Web Performance πŸ› Structure & /phacks

Slide 8

Slide 8

The Culture of Web Performance πŸ› Structure πŸ›  Tooling & /phacks

Slide 9

Slide 9

The Culture of Web Performance πŸ› Structure πŸ›  Tooling πŸ’‘ Knowledge & /phacks

Slide 10

Slide 10

πŸ› Structure Leveraging Lean methodologies & /phacks

Slide 11

Slide 11

What is Lean? Lean is a systematic method to maximize customer value while minimizing waste. & /phacks

Slide 12

Slide 12

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. & /phacks

Slide 13

Slide 13

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 14

Slide 14

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. & /phacks

Slide 15

Slide 15

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. & /phacks

Slide 16

Slide 16

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 17

Slide 17

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 18

Slide 18

Identifying the Value Stream & /phacks

Slide 19

Slide 19

Identifying the Value Stream ⏱ βœ… ⏱ ⏱ ❌ βœ… Cache Control: Private & /phacks

Slide 20

Slide 20

Identifying the Value Stream πŸ‘€ Forces to look at the whole process, not only frontend/ backend & /phacks

Slide 21

Slide 21

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 & /phacks

Slide 22

Slide 22

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 23

Slide 23

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. In Lean, this is called Jidoka. & /phacks

Slide 24

Slide 24

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 25

Slide 25

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 26

Slide 26

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 27

Slide 27

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 28

Slide 28

πŸ›  Tooling The Tools of the Trade & /phacks

Slide 29

Slide 29

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 30

Slide 30

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 31

Slide 31

Why Did You Update? ❓ why-did-you-update: Displays a warning in the Chrome console when a React makes unnecessary updates πŸ’‘ Helpful for: detecting useless renders slowing down the UI. & /phacks

Slide 32

Slide 32

Keeping it small πŸ“¦ bundlesize: CI-friendly bundle size checker. πŸ’‘ Helpful for: detecting if your JS goes over a certain threshold & /phacks

Slide 33

Slide 33

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 34

Slide 34

πŸ’‘ Knowledge Knowledge is power, Sharing is better & /phacks

Slide 35

Slide 35

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. & /phacks

Slide 36

Slide 36

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. & /phacks

Slide 37

Slide 37

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. πŸ“ˆ Showcase your successes: I set up a whiteboard showcasing performant projects, what we learned, and what we’re focusing on right now. & /phacks

Slide 38

Slide 38

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

Slide 39

Slide 39

Best resources to get started πŸ“– HPBN: High Performance Browser Networking β€” a free ebook teaching deep understanding of how browsers & Web protocols work, so that you can get the most of them & /phacks

Slide 40

Slide 40

πŸ™ Thanks! & /phacks

Slide 41

Slide 41

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 Update?: https://github.com/maicki/why-did-you-update Web.dev: https://web.dev/learn HPBN: https://hpbn.co/ & /phacks