Comparing JavaScript Frameworks Performance Using Real-World Data

Rate this content
Bookmark

Google collects performance information from all sessions on opted-in Chrome browsers into its Chrome User Experience Report (CrUX) database. It then uses this information as a ranking factor for its search engine, but it also makes this information publicly available for everyone to view. I used this data to analyze and compare the performance of the leading JavaScript frameworks. In particular, I looked at the likelihood that websites built using each framework will have good Core Web Vitals (CWV) scores. Along the way I encountered several surprising results, and solved at least one mystery. See how your favorite framework ranks vs all the rest!

This talk has been presented at JSNation 2023, check out the latest edition of this JavaScript Conference.

FAQ

Dan Shapir is the Performance Tech Lead at Next Insurance and a host and panelist on the JavaScript Jabber Weekly podcast. He is also an invited expert on the W3C Web Performance Working Group.

The primary focus of Dan Shapir's talk is on web performance, specifically on how the choice of JavaScript frameworks impacts the performance of websites and web apps.

The two main methods for measuring web performance are lab tests and field data. Lab tests measure performance in a controlled environment, while field data collects performance data from actual sessions of real users.

The Core Web Vitals Technology Report is an interactive dashboard created by Rick Viscomi at Google. It allows users to query and graph the aggregated performance data for websites built using various web technologies identified by WebAnalyzer.

The three Core Web Vital metrics are Largest Contentful Paint (LCP), First Input Delay (FID), and Cumulative Layout Shift (CLS). LCP measures the time to display the largest content, FID measures the time to respond to the first user interaction, and CLS measures the amount of unexpected layout shift.

Google collects performance data through the Chrome User Experience Database (CRUX). The Chrome browser collects performance information about every session of every website visited and sends it to Google's database in the cloud.

Meta-frameworks, such as Next.js, Gatsby, and Remix, are intended to improve web performance by enabling features like server-side rendering (SSR) and static-site generation (SSG). However, the performance impact varies across different meta-frameworks.

Choosing the right JavaScript framework is important for web performance because the framework decides when and how to run your code, handle user interactions, and update the display. This can significantly impact the overall performance of the website or web app.

Websites built using Wix generally have better performance than custom websites built manually with React or React meta-frameworks like Next.js, Gatsby, and Remix.

Dan Shapir found that Svelte, despite being known for good performance, appeared to perform worse than other frameworks in global data. However, when filtered to the US, Svelte showed better performance, indicating that geographical factors might affect performance data.

Dan Shappir
Dan Shappir
28 min
05 Jun, 2023

Comments

Sign in or register to post your comment.

Video Summary and Transcription

The choice of framework impacts website performance. Lab tests and field data are used to measure performance. Core Web Vitals are important metrics for performance evaluation. New frameworks that prioritize speed are emerging. MetaFrameworks like QUIC, SolidStart, Astro, and Nuxt show promise in improving performance. React frameworks like Gatsby and Remix perform well. Wix has a significant impact on React's performance. Framework choice significantly impacts the probability of building a fast website. Improvement is needed in framework performance.

1. Introduction to Web Performance and Frameworks

Short description:

Hello everybody, in this part, I will discuss how the choice of framework impacts the performance of websites and web apps. I'll use real-world data to compare the performance impact of leading JavaScript frameworks and meta-frameworks. Our choice of framework can have a huge impact on website performance. With so many frameworks and meta-frameworks available, it's important to choose the one that helps us build a fast website. To determine the best framework, we need to measure and compare them. The first method for measuring performance is lab tests.

Hello everybody, I hope you're enjoying the JS Nation conference. Today I'm going to talk about web performance, and specifically about how your choice of framework impacts the performance of the websites and web apps that you build. In order to do this, I'll be using real-world data to compare the performance impact of the leading JavaScript frameworks and meta-frameworks.

First though, a few words about myself. My name is Dan Shapir, and I'm the Performance Tech Lead at Next Insurance. We're an InsurTech unicorn aiming to revolutionize the way in which small businesses get insurance. And as everything is done online, it's critical that performance is as fast as possible. I'm also a host and panelist on the popular JavaScript Jabber Weekly podcast. I'm an invited expert on the W3C Web Performance Working Group where the performance metrics I will describe today are discussed and standardized. If you want to contact me about web performance or web development in general, you're welcome to do so on Twitter or Masterdon.

Speaking about web performance, we all know that building fast websites can be hard. And it's not just hard for you or me, it's hard for everybody. And that's the reason that according to Google, the majority of the websites it indexes do not have good performance. For this reason, when we select which tools to use for building websites, we want to choose tools that will set us up for performance success. Certainly, we don't want to choose tools that will set us up to fail. And probably the most important tool we choose as web developers, the most impactful item in our arsenal, is the framework we use. The reason for this is that when we build a website, it's the framework that's in the driver's seat. Our code is sitting in the back, telling the framework where to go and hoping that it takes us there. It's the framework that decides where and when to run our code, which parameters and state to pass to our code, what to do with the values our code provides to it, when to update the display, how to handle user interactions, etc. So, it's really not surprising that our choice of framework can have a huge impact on the performance of the websites we build with it.

Fortunately, these days we are spoilt for choice when it comes to deciding which framework to use. In fact, it seems like a new framework is being introduced almost on a daily basis. And what's more, a prime motivation for the creation of new frameworks is often web performance. They aim to enable us to build faster websites, more easily and consistently. In addition, there are a whole bunch of meta-frameworks implemented on top of these frameworks. For example, if you want to build websites using React, you can do so with Next.js or Emix or Gatsby or Astro and others. So the question is, which framework or meta-framework should we choose? The answer to that is that with all else being equal, we should prefer to use the framework that is the most likely to help us produce a fast website. But how can we know which framework that is? The answer to that is that we need to measure them and compare. There are two main methods for measuring performance on the web. The first method is known as lab tests.

2. Measuring Website Performance

Short description:

Measuring website performance can be done through lab tests or field data collection. Lab tests provide complete control and visibility, but can be challenging to set up and replicate scenarios. Field data involves collecting performance data from real user sessions, ensuring accurate measurements. Google's Chrome User Experience Database (CRUX) collects performance data from Chrome browser sessions and uses it as a ranking signal for search engine results.

This means measuring website performance in a controlled environment. Ideally, it should replicate the environments in which real users access our website. The main advantage of using this method is that it provides total control over the tests and complete visibility into the results. We can inspect every facet and behavior of our code and recreate it as required.

But lab tests are also difficult to do because setting up the lab environment can be challenging, and determining exactly which scenarios we should replicate can also be difficult. Lab tests are especially problematic when we want to compare performance of the various frameworks because we need to build the exact same applications using every framework we want to test. There are some tools that can help us automate this process, but significant time and effort may still be required.

The other approach that we can take is to use field data. That means collecting performance data from actual sessions of real users, preferably as many as possible. Random user measurements, or RUM for short, is about getting performance data from live sessions and using that data for the comparisons. This way, we can be certain that what we measure actually reflects what our users are experiencing. But how can we gain access to the performance data for all those sessions? Is it possible to instrument every website built using any framework so that it reports the performance data for every session, and then to collect this data into some sort of database so that we can generate comparisons?

Obviously, we cannot do something like that. But it turns out that someone can, and that someone is Google. That's because instead of instrumenting the websites, they instrumented the platform on which these websites run, the Chrome browser itself. Unless you opt out, the Chrome browser collects performance information about every session of every website that you visit and sends it up to Google Database in the cloud. This database is the Chrome User Experience Database, or CRUX for short. Google uses all this performance information that it gathers as a ranking signal for its search engine. That means that when Google decides how to order results in the search engine results page, it gives a ranking boost to pages that have better performance according to this data.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

A Guide to React Rendering Behavior
React Advanced Conference 2022React Advanced Conference 2022
25 min
A Guide to React Rendering Behavior
Top Content
This transcription provides a brief guide to React rendering behavior. It explains the process of rendering, comparing new and old elements, and the importance of pure rendering without side effects. It also covers topics such as batching and double rendering, optimizing rendering and using context and Redux in React. Overall, it offers valuable insights for developers looking to understand and optimize React rendering.
Building Better Websites with Remix
React Summit Remote Edition 2021React Summit Remote Edition 2021
33 min
Building Better Websites with Remix
Top Content
Remix is a web framework built on React Router that focuses on web fundamentals, accessibility, performance, and flexibility. It delivers real HTML and SEO benefits, and allows for automatic updating of meta tags and styles. It provides features like login functionality, session management, and error handling. Remix is a server-rendered framework that can enhance sites with JavaScript but doesn't require it for basic functionality. It aims to create quality HTML-driven documents and is flexible for use with different web technologies and stacks.
Speeding Up Your React App With Less JavaScript
React Summit 2023React Summit 2023
32 min
Speeding Up Your React App With Less JavaScript
Top Content
Watch video: Speeding Up Your React App With Less JavaScript
Mishko, the creator of Angular and AngularJS, discusses the challenges of website performance and JavaScript hydration. He explains the differences between client-side and server-side rendering and introduces Quik as a solution for efficient component hydration. Mishko demonstrates examples of state management and intercommunication using Quik. He highlights the performance benefits of using Quik with React and emphasizes the importance of reducing JavaScript size for better performance. Finally, he mentions the use of QUIC in both MPA and SPA applications for improved startup performance.
Full Stack Documentation
JSNation 2022JSNation 2022
28 min
Full Stack Documentation
Top Content
The Talk discusses the shift to full-stack frameworks and the challenges of full-stack documentation. It highlights the power of interactive tutorials and the importance of user testing in software development. The Talk also introduces learn.svelte.dev, a platform for learning full-stack tools, and discusses the roadmap for SvelteKit and its documentation.
React Concurrency, Explained
React Summit 2023React Summit 2023
23 min
React Concurrency, Explained
Top Content
Watch video: React Concurrency, Explained
React 18's concurrent rendering, specifically the useTransition hook, optimizes app performance by allowing non-urgent updates to be processed without freezing the UI. However, there are drawbacks such as longer processing time for non-urgent updates and increased CPU usage. The useTransition hook works similarly to throttling or bouncing, making it useful for addressing performance issues caused by multiple small components. Libraries like React Query may require the use of alternative APIs to handle urgent and non-urgent updates effectively.
SolidJS: Why All the Suspense?
JSNation 2023JSNation 2023
28 min
SolidJS: Why All the Suspense?
Top Content
Suspense is a mechanism for orchestrating asynchronous state changes in JavaScript frameworks. It ensures async consistency in UIs and helps avoid trust erosion and inconsistencies. Suspense boundaries are used to hoist data fetching and create consistency zones based on the user interface. They can handle loading states of multiple resources and control state loading in applications. Suspense can be used for transitions, providing a smoother user experience and allowing prioritization of important content.

Workshops on related topic

React Performance Debugging Masterclass
React Summit 2023React Summit 2023
170 min
React Performance Debugging Masterclass
Top Content
Featured WorkshopFree
Ivan Akulov
Ivan Akulov
Ivan’s first attempts at performance debugging were chaotic. He would see a slow interaction, try a random optimization, see that it didn't help, and keep trying other optimizations until he found the right one (or gave up).
Back then, Ivan didn’t know how to use performance devtools well. He would do a recording in Chrome DevTools or React Profiler, poke around it, try clicking random things, and then close it in frustration a few minutes later. Now, Ivan knows exactly where and what to look for. And in this workshop, Ivan will teach you that too.
Here’s how this is going to work. We’ll take a slow app → debug it (using tools like Chrome DevTools, React Profiler, and why-did-you-render) → pinpoint the bottleneck → and then repeat, several times more. We won’t talk about the solutions (in 90% of the cases, it’s just the ol’ regular useMemo() or memo()). But we’ll talk about everything that comes before – and learn how to analyze any React performance problem, step by step.
(Note: This workshop is best suited for engineers who are already familiar with how useMemo() and memo() work – but want to get better at using the performance tools around React. Also, we’ll be covering interaction performance, not load speed, so you won’t hear a word about Lighthouse 🤐)
Building WebApps That Light Up the Internet with QwikCity
JSNation 2023JSNation 2023
170 min
Building WebApps That Light Up the Internet with QwikCity
Featured WorkshopFree
Miško Hevery
Miško Hevery
Building instant-on web applications at scale have been elusive. Real-world sites need tracking, analytics, and complex user interfaces and interactions. We always start with the best intentions but end up with a less-than-ideal site.
QwikCity is a new meta-framework that allows you to build large-scale applications with constant startup-up performance. We will look at how to build a QwikCity application and what makes it unique. The workshop will show you how to set up a QwikCitp project. How routing works with layout. The demo application will fetch data and present it to the user in an editable form. And finally, how one can use authentication. All of the basic parts for any large-scale applications.
Along the way, we will also look at what makes Qwik unique, and how resumability enables constant startup performance no matter the application complexity.
Back to the Roots With Remix
React Summit 2023React Summit 2023
106 min
Back to the Roots With Remix
Featured Workshop
Alex Korzhikov
Pavlik Kiselev
2 authors
The modern web would be different without rich client-side applications supported by powerful frameworks: React, Angular, Vue, Lit, and many others. These frameworks rely on client-side JavaScript, which is their core. However, there are other approaches to rendering. One of them (quite old, by the way) is server-side rendering entirely without JavaScript. Let's find out if this is a good idea and how Remix can help us with it?
Prerequisites- Good understanding of JavaScript or TypeScript- It would help to have experience with React, Redux, Node.js and writing FrontEnd and BackEnd applications- Preinstall Node.js, npm- We prefer to use VSCode, but also cloud IDEs such as codesandbox (other IDEs are also ok)
Next.js 13: Data Fetching Strategies
React Day Berlin 2022React Day Berlin 2022
53 min
Next.js 13: Data Fetching Strategies
Top Content
WorkshopFree
Alice De Mauro
Alice De Mauro
- Introduction- Prerequisites for the workshop- Fetching strategies: fundamentals- Fetching strategies – hands-on: fetch API, cache (static VS dynamic), revalidate, suspense (parallel data fetching)- Test your build and serve it on Vercel- Future: Server components VS Client components- Workshop easter egg (unrelated to the topic, calling out accessibility)- Wrapping up
React Performance Debugging
React Advanced Conference 2023React Advanced Conference 2023
148 min
React Performance Debugging
Workshop
Ivan Akulov
Ivan Akulov
Ivan’s first attempts at performance debugging were chaotic. He would see a slow interaction, try a random optimization, see that it didn't help, and keep trying other optimizations until he found the right one (or gave up).
Back then, Ivan didn’t know how to use performance devtools well. He would do a recording in Chrome DevTools or React Profiler, poke around it, try clicking random things, and then close it in frustration a few minutes later. Now, Ivan knows exactly where and what to look for. And in this workshop, Ivan will teach you that too.
Here’s how this is going to work. We’ll take a slow app → debug it (using tools like Chrome DevTools, React Profiler, and why-did-you-render) → pinpoint the bottleneck → and then repeat, several times more. We won’t talk about the solutions (in 90% of the cases, it’s just the ol’ regular useMemo() or memo()). But we’ll talk about everything that comes before – and learn how to analyze any React performance problem, step by step.
(Note: This workshop is best suited for engineers who are already familiar with how useMemo() and memo() work – but want to get better at using the performance tools around React. Also, we’ll be covering interaction performance, not load speed, so you won’t hear a word about Lighthouse 🤐)
High-performance Next.js
React Summit 2022React Summit 2022
50 min
High-performance Next.js
Workshop
Michele Riva
Michele Riva
Next.js is a compelling framework that makes many tasks effortless by providing many out-of-the-box solutions. But as soon as our app needs to scale, it is essential to maintain high performance without compromising maintenance and server costs. In this workshop, we will see how to analyze Next.js performances, resources usage, how to scale it, and how to make the right decisions while writing the application architecture.