Vite vs SWC vs Webpack: A Performance Comparison for React Applications

Younis Jad
Lyonas
Published in
3 min readJul 11, 2023

Are you looking to improve the performance of your React applications? In today’s fast-paced development world, it’s important to choose the right tools to help you build faster and more efficient applications. In this article, we’ll compare the performance of a Vite vs SWC vs Webpack.

importance of performance in web applications

I recognize the importance of performance in all stages of developing, building, and serving. Ensuring performance at each stage is critical to achieving a well-performing application.

During development, performance plays a crucial role in productivity. For instance, if the development environment is slow, it can demotivate developers, leading to lower productivity. A well-optimized development environment can encourage developers to write quality code, leading to better performance in the final product.

Similarly, building and serving a web application requires optimized performance. The build process should be as fast and efficient as possible to reduce downtime between development cycles and ensure that the latest changes are quickly integrated into the application. When serving the application, optimized performance ensures that users can interact with the app seamlessly and without delay, leading to a more positive user experience.

In summary, prioritizing performance during all stages of development, building, and serving of web applications is critical for achieving an excellent user experience and high productivity.

tools and specs

our example app should have significant implementation, so we will be using varies of components, ant design, react router.

all test are conducted using github codespaces instance, and used hyperfine for CLI benchmarking.

Performance Check

Vite

  • Build tool: babel.js
  • Run Time (mean ± σ): 292.5 ms ± 13.7 ms
  • Build Time (mean ± σ): 286.6 ms ± 22.9 ms
  • Time Range (min … max): 267.4 ms … 496.2 ms
  • Runs: 100 runs
  • Bundle Size: 851.84 kb ± 50 kb

Vite + SWC

  • Build tool: rust SWC
  • Run Time (mean ± σ): 269.4 ms ± 13.1 msÏ
  • Build Time (mean ± σ): 287.1 ms ± 15.1 ms
  • Time Range (min … max): 276.1 ms … 386.6 ms
  • Runs: 100 runs
  • Bundle Size: 851.84 kb ± 50 kb

Create React App

  • Build tool: Webpack
  • Run Time (mean ± σ): 289.8 ms ± 7.8 ms
  • Build Time (mean ± σ): 283.5 ms ± 12.1 ms
  • Time Range (min … max): 270.9 ms … 385.5 ms
  • Runs: 100 runs
  • Bundle Size: 266.19 kB ± 10 kb

Conculsion

Based on the performance check, it is evident that all three build tools Vite + SWC, Vite with Babel.js, and Create React App — are viable options for developing and building a React application. While Vite + SWC has the fastest run time, Vite with Babel.js has the fastest build time and Create React App resulted in the smallest bundle size. Although there is minimal difference in run time between the tools, the choice of the build tool may differ depending on the developer’s preference and specific project requirements. Therefore, developers should consider these factors while choosing the right build tool for their React app.

you can find Source Code on Github and instruction on Running benchmarks locally.

Thank You for Reading!

Share your thoughts in the comments and stay tuned for more great content like this by giving us a follow. We can’t wait to hear what you have to say!

--

--

Younis Jad
Lyonas
Editor for

Tech Evangelist, Experienced software engineer, Passionate about learning and building innovative, scalable solutions.