Git Product home page Git Product logo

parcel-vs-vite-vs-turbopack-hmr's Introduction

Parcel vs Vite vs Turbopack HMR Benchmark

Based on this benchmark by Evan You, creator of Vite.

Methodology

  1. There are 3 projects in this repo: Next.js 13 with Turbopack, Vite with SWC plugin, and Parcel.

  2. genFiles.(m)js is run in each project to generate 1000 components. All components are imported in the app's root component (in Next's case, the root page component) and rendered together. This step is already done and the files are already checked in, but the script is included for reference.

  3. For Next, app/page.js has the 'use client' directive so it renders in client mode. This is necessary to ensure proper comparison, since server components incurs non-trivial HMR overhead (4x slower).

  4. Start the projects by running yarn dev in each project, and open the page in Chrome.

  5. Run update.mjs within each project, with either leaf or root as an argument. This updates either the leaf or root components respectively, which renders the current time in the browser at the time React rerenders minus the time the file was written. This measures the total amount of time taken from saving a change to seeing it reflected.

Numbers

  • Recorded over 5 runs
  • Time in ms
  • Tested on M1 Ultra Mac Studio
Vite (root) Vite (leaf) Turbopack (root) Turbopack (leaf) Parcel (root) Parcel (leaf)
1 285 147 292 58 94 38
2 291 143 262 57 94 38
3 296 140 274 57 87 36
4 302 145 275 57 81 37
5 292 144 271 56 87 38
Average 293.5 143.8 274.8 57 88.6 37.4

Notes

  • macOS FSEvents adds ~13 ms of latency between when a file is modified to when tools start building. That latency is included in these results.
  • Parcel is 34% faster than Turbopack, and 74% faster than Vite at updating the leaf component.
  • Parcel is 68% faster than Turbopack, and 70% faster than Vite at updating the root component.

parcel-vs-vite-vs-turbopack-hmr's People

Contributors

yyx990803 avatar devongovett avatar arnaudbarre avatar leedom92 avatar puruvj avatar pengbouestc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.