Skip to content
Myr

README.md

This file

Path

perf-testing/README.md

71 lines · 1.7 KiB · Markdown

Last changed by

test: Implement a perf testing benchmarking system (#1163)Mark Eriksonbefore adoptionefa396d

History of this file

Take it

test: Implement a perf testing benchmarking system (#1163)Mark Eriksonbefore adoptionefa396d

lines 1–71why, one step back
1# Immer Performance Testing
23This directory contains performance testing tools for Immer, allowing you to benchmark different versions of Immer and analyze CPU profiles to identify performance bottlenecks.45## Setup671. **Install dependencies** (in this directory):89 ```bash10 yarn install11 ```12132. **Build Immer first**:1415 ```bash16 yarn build-immer17 ```18193. **Build the benchmark bundle**:20 ```bash21 yarn build22 ```2324Alternately, you can rebuild both Immer and the benchmarking script:2526```bash27yarn build-with-latest28```2930## Usage3132### Running Benchmarks3334To run the performance benchmarks:3536```bash37# Run basic benchmarks, with relative version speed comparisons38yarn benchmark3940# Run the benchmarks, but also generate a CPU profile41yarn profile42```4344### Analyzing CPU Profiles4546After running `yarn profile`, you'll get a `.cpuprofile` file. To analyze it:4748```bash49# Analyze the most recent profile50yarn analyze-profile your-profile.cpuprofile51```5253## What's Included5455- **immutability-benchmarks.mjs**: Main benchmark script comparing different Immer versions56- **read-cpuprofile.js**: Advanced CPU profile analyzer with sourcemap support57- **rolldown.config.js**: Bundler configuration that eliminates `process.env` overhead5859## Benchmark Versions6061The benchmarks compare:6263- **immer7-10**: Historical Immer versions64- **immer10Perf**: Current development version (references `../dist`)65- **vanilla**: Pure JavaScript implementations for baseline comparison6667## Key Features6869- **Sourcemap support**: CPU profile analysis includes original function names70- **Version-aware analysis**: Breaks down performance by Immer version71- **Production bundling**: Uses Rolldown to eliminate development overhead