rsnext/packages
Jiwon Choi ef83433c3e
perf: improve retrieving versionInfo on Turbo HMR (#67309)
### Why?

Identified the bottleneck of Turbopack HMR, one of the reason is that we
run `execSync` to get user's package manager and fetch their registry to
get the latest & canary version of Next.js.
This process was located at the initial of HMR, which could have been
delayed to the initial of the error handling.

### How?

- Remove getting user's package manager and just fetch from NPM
regardless the user uses Yarn.
- Used an async IIFE to await the promise of `getVerionInfo` value
inside the synchronous `ws.handleUpgrade`.

### Benchmark

> Benchmarked with console inside try-finally

#### Webpack -- no cache

| Version                              | Ready |
|-------------------------------------|---------|
| Canary | 1185ms |
| Delta | 896ms |
| Delta Webpack vs Canary Webpack | -24.39% |

#### Turbopack

| Version                              | Ready |
|-------------------------------------|---------|
| Canary | 1002ms |
| Delta (Turbopack) | 509ms |
| Delta Turbopack vs Canary Turbopack | -49.20% |

---------

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2024-07-02 02:16:22 +09:00
..
create-next-app v15.0.0-canary.49 2024-06-29 23:22:57 +00:00
eslint-config-next v15.0.0-canary.49 2024-06-29 23:22:57 +00:00
eslint-plugin-next v15.0.0-canary.49 2024-06-29 23:22:57 +00:00
font v15.0.0-canary.49 2024-06-29 23:22:57 +00:00
next perf: improve retrieving versionInfo on Turbo HMR (#67309) 2024-07-02 02:16:22 +09:00
next-bundle-analyzer v15.0.0-canary.49 2024-06-29 23:22:57 +00:00
next-codemod v15.0.0-canary.49 2024-06-29 23:22:57 +00:00
next-env v15.0.0-canary.49 2024-06-29 23:22:57 +00:00
next-mdx v15.0.0-canary.49 2024-06-29 23:22:57 +00:00
next-plugin-storybook v15.0.0-canary.49 2024-06-29 23:22:57 +00:00
next-polyfill-module v15.0.0-canary.49 2024-06-29 23:22:57 +00:00
next-polyfill-nomodule v15.0.0-canary.49 2024-06-29 23:22:57 +00:00
next-swc v15.0.0-canary.49 2024-06-29 23:22:57 +00:00
react-refresh-utils v15.0.0-canary.49 2024-06-29 23:22:57 +00:00
third-parties v15.0.0-canary.49 2024-06-29 23:22:57 +00:00