Skip to content

hamlim/rspack-before-module-ids-perf-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rspack-testing

Test app for benchmarking rspack's beforeModuleIds hook performance, as implemented in this pr: web-infra-dev/rspack#12809.

Setup

Link to local copy of rspack (with these changes). Make sure rspack is built first:

cd local/copy/of/rspack
pnpm run build:binding:dev
pnpm run build:js

Then install dependencies:

cd copy/of/this/repo
bun install

Benchmarks

Compare build performance with and without the beforeModuleIds hook:

bun run bench         # 10 runs, 3 warmups
bun run bench:quick   # 5 runs, 1 warmup
bun run bench:detailed # 20 runs, exports to bench-results.json

Results from M3 Max MacBook Pro w/ 32Gb of ram:

bun run bench:detailed
$ hyperfine --warmup 3 --runs 20 --export-json bench-results.json 'bun run build:no-hook' 'bun run build:with-hook'
Benchmark 1: bun run build:no-hook
  Time (mean ± σ):     486.5 ms ±  12.7 ms    [User: 2164.4 ms, System: 243.9 ms]
  Range (min … max):   466.8 ms … 510.1 ms    20 runs

Benchmark 2: bun run build:with-hook
  Time (mean ± σ):     502.3 ms ±  14.4 ms    [User: 2192.6 ms, System: 251.0 ms]
  Range (min … max):   483.3 ms … 546.9 ms    20 runs

Summary
  bun run build:no-hook ran
    1.03 ± 0.04 times faster than bun run build:with-hook

Manual Builds

USE_BEFORE_MODULE_IDS_HOOK=0 bun run build  # Without hook
USE_BEFORE_MODULE_IDS_HOOK=1 bun run build  # With hook

Regenerate Test Modules

Generates 500 modules across 20 chunks. Edit scripts/generate-modules.mjs to adjust.

bun run generate

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors