rsnext/bench/fuzzponent
Tim Neutkens 00106b7ef4
Optimize webpack memory cache garbage collection (#54397)
## What

Adds a reworked version of webpack's [built-in memory cache garbage
collection
plugin](853bfda35a/lib/cache/MemoryWithGcCachePlugin.js (L15))
that is more aggressive in cleaning up unused modules than the default.

The default marks 1/5th of the modules as "up for potentially being
garbage collected". The new plugin always checks all modules. In my
testing this does not cause much overhead compared to the current
approach which leverages writing to two separate maps. The change also
makes the memory cache eviction more predictable: when an item has not
been accessed for 5 compilations it is evicted from the memory cache, it
could still be in the disk cache.


In order to test this change I had to spin up the benchmarks but these
were a bit outdated so I've cleaned up the benchmark applications.

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-08-23 15:46:32 +02:00
..
bin Optimize webpack memory cache garbage collection (#54397) 2023-08-23 15:46:32 +02:00
package.json Optimize webpack memory cache garbage collection (#54397) 2023-08-23 15:46:32 +02:00
readme.md Optimize webpack memory cache garbage collection (#54397) 2023-08-23 15:46:32 +02:00

Fuzzponent

Originally built by Dale Bustad while at Vercel.

Original repository.

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"]