Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize webpack memory cache garbage collection #54397

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ test/production/emit-decorator-metadata/**/*.js
test/e2e/app-dir/rsc-errors/app/swc/use-client/page.js
test-timings.json
packages/next-swc/crates/**
bench/nested-deps/pages/**
bench/nested-deps/components/**
bench/nested-deps/**
bench/nested-deps-app-router/**
packages/next-bundle-analyzer/index.d.ts
examples/with-typescript-graphql/lib/gql/
test/development/basic/hmr/components/parse-error.js
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ test/node_modules
*.log
pids
*.cpuprofile
*.heapsnapshot

# coverage
.nyc_output
Expand Down
15 changes: 15 additions & 0 deletions bench/app-router-server/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "bench-app-router-server",
"private": true,
"license": "MIT",
"dependencies": {
"webpack-bundle-analyzer": "^4.6.1",
"webpack-stats-plugin": "^1.1.0",
"next": "workspace:*",
"next-minimal-server": "workspace:*"
},
"scripts": {
"build-application": "next build",
"start": "next-minimal-server"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ if (require.main === module) {
type: 'string',
}).argv

fs.mkdirSync(outdir, { recursive: true })
generateFuzzponents(outdir, seed, depth, opts)
}

Expand Down
12 changes: 12 additions & 0 deletions bench/fuzzponent/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "fuzzponent",
"bin": {
"fuzzponent": "./bin/fuzzponent.js"
},
"dependencies": {
"@babel/types": "7.18.0",
"@babel/generator": "7.18.0",
"random-seed": "0.3.0",
"yargs": "16.2.0"
}
}
39 changes: 39 additions & 0 deletions bench/fuzzponent/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Fuzzponent

Originally built by [Dale Bustad](https://github.com/divmain/fuzzponent) while at Vercel.

[Original repository](https://github.com/divmain/fuzzponent).

Generate a nested React component dependency graph, useful for benchmarking.

## Example

To create a dependency tree with `3020` files in the `components` directory:

```
fuzzponent --depth 2 --seed 206 --outdir components
```

You can then import the entrypoint of the dependency tree at `components/index.js`.

## Options

```
Options:
--help Show help [boolean]
--version Show version number [boolean]
-d, --depth component hierarchy depth [number] [required]
-s, --seed prng seed [number] [required]
-o, --outdir the directory where components should be written
[string] [default: "/Users/timneutkens/projects/next.js/bench/nested-deps"]
--minLen the smallest acceptable component name length
[number] [default: 18]
--maxLen the largest acceptable component name length
[number] [default: 24]
--minChild the smallest number of acceptable component children
[number] [default: 4]
--maxChild the largest number of acceptable component children
[number] [default: 80]
--extension extension to use for generated components
[string] [default: "jsx"]
```
14 changes: 0 additions & 14 deletions bench/minimal-server/benchmark-app/package.json

This file was deleted.

2 changes: 2 additions & 0 deletions bench/nested-deps-app-router/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
components/*
CPU*
13 changes: 13 additions & 0 deletions bench/nested-deps-app-router/app/client-components-only/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use client'
import React from 'react'

import Comp from '../../components/index.jsx'

export default function Home() {
return (
<>
<h1>Hello!!!!!!!!!!!!</h1>
<Comp />
</>
)
}
14 changes: 14 additions & 0 deletions bench/nested-deps-app-router/app/layout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react'

export const metadata = {
title: 'Next.js',
description: 'Generated by Next.js',
}

export default function RootLayout({ children }) {
return (
<html lang="en">
<body>{children}</body>
</html>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use client'
import React from 'react'

import Comp from '../../components/index.jsx'

export default function Home() {
return <Comp />
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react'
import Comp from '../../components/index.jsx'
import ClientComponent from './client-component'

export default function Home() {
return (
<>
<Comp />
<ClientComponent />
</>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react'
import Comp from '../../components/index.jsx'

export default function Home() {
return <Comp />
}
Loading