Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: lazyload the edge runtime in NextServer (vercel#41322)
## Context I'm investigating cold boot perf ## This PR Did some manual analysis on next cold boot for the "regular" node target and found out that we are spending a good 10ms evaluating the edge runtime module when we shouldn't be in most cases. This is a quick fix to only load it when actually required. ## Test plan I have a simple script which I'll push in a separate PR to measure the cold boot. Results: before: <img width="230" alt="image" src="https://user-images.githubusercontent.com/11064311/195073994-c3d28961-5d22-401f-a4b0-026c791ff2bd.png"> after: <img width="275" alt="image" src="https://user-images.githubusercontent.com/11064311/195073941-a0897532-6e9f-482d-a1f0-8b9c9231c6b0.png"> it appears to be a 10~15ms win on cold boot ## Following up We probably want a separate NextMinimalServer type of build? ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
- Loading branch information