Automated React Performance Testing

Catch render regressions before they reach production. Built for Playwright with zero boilerplate and comprehensive metrics.

npm MIT PRs
performance.spec.ts
$ npx playwright test --project=perf
[Performance] TEST: checkout-flow
Env: CI • Throttle: 4x • Iterations: 3
Metric Actual Threshold Status
Duration 42.5ms < 100ms PASS
Renders 8 ≤ 12 PASS
FPS 58.2 ≥ 55 PASS
Memory +2.1MB < 10MB PASS
ALL CHECKS PASSED

Performance Testing Is Broken

Most teams discover performance regressions in production. There's a better way.

🔥

The Problem

Slow renders sneak into production undetected. Users experience lag while your metrics look fine.

🕐

Traditional Approach

Manual profiling is time-consuming, inconsistent, and easily forgotten during code reviews.

Our Solution

Automated performance budgets in your test suite. Fail builds before regressions reach production.

Everything You Need

Comprehensive performance testing tools built for modern React applications.

📊

React Profiler

Real render metrics via React's Profiler API with automatic phase detection.

🎭

Playwright Integration

Drop-in test.performance() helper with zero configuration required.

🧩

Component Profiling

Per-component breakdown with mount/update phase tracking.

🐢

CPU Throttling

Simulate slower devices with 4x, 6x, or custom CPU slowdown.

🌐

Network Throttling

3G/4G presets or custom conditions for realistic testing.

🎞

FPS Tracking

Frame rate measurement via CDP Tracing with threshold assertions.

🧠

Memory Tracking

Detect memory leaks with heap growth monitoring and alerts.

💓

Web Vitals

LCP, INP, CLS tracking that works in all browsers.

📈

Percentile Metrics

P50/P95/P99 thresholds for statistical reliability.

🔥

Trace Export

Chrome DevTools compatible flamegraph export for deep analysis.

CI/CD Ready

Auto warmup and environment-aware thresholds for CI.

Zero Boilerplate

Minimal configuration to get started in minutes.

Up and Running in Minutes

Three simple steps to add automated performance testing.

1

Install

Add the package

2

Wrap

Add provider

3

Test

Write tests

Terminal
# Install the package
npm install react-performance-tracking
App.tsx
import { Profiler } from 'react';
import {
  PerformanceProvider,
  usePerformanceRequired
} from 'react-performance-tracking/react';

function App() {
  return (
    <PerformanceProvider>
      <MyComponent />
    </PerformanceProvider>
  );
}

function MyComponent() {
  const { onProfilerRender } = usePerformanceRequired();
  return (
    <Profiler id="my-component" onRender={onProfilerRender}>
      {/* Your component content */}
    </Profiler>
  );
}
checkout.perf.spec.ts
import { test as base } from '@playwright/test';
import { createPerformanceTest } from 'react-performance-tracking/playwright';

const test = createPerformanceTest(base);

test.performance({
  warmup: true,                       // First iteration for cache warming
  iterations: 5,                      // Run 5 times for reliability
  throttleRate: 4,                    // Simulate 4x slower CPU
  networkThrottling: 'fast-3g', // Simulate 3G
    network
  exportTrace: true,                  // Chrome DevTools flamegraph
  thresholds: {
    base: {
      profiler: {
        'my-component': {
          duration: { avg: 500, p95: 200, p99: 400 },
          rerenders: 15,
        },
      },
      fps: 60,
      memory: { heapGrowth: 10 * 1024 * 1024 },
      webVitals: { lcp: 2500, inp: 200, cls: 0.1 },
    },
    ci: {                              // More lenient in CI
      profiler: { 'my-component': { duration: {
      avg: 600 } } },
    },
  },
})('checkout flow performance', async ({ page, performance }) => {
  await page.goto('/checkout');
  await performance.init();

  // Track custom timing metrics
  performance.mark('form-start');
  await page.fill('input[name="email"]', 'test@example.com');
  await page.click('button[type="submit"]');
  await performance.waitUntilStable();
  performance.mark('form-end');

  const formTime = performance.measure('form-submit', 'form-start', 'form-end');
  console.log(`Form submission: ${formTime}ms`);
});

Build Your Configuration

Configure your performance test visually and copy the generated code.

Loading Config Builder...

Catch Slowdowns Before Users Do

Join teams using automated performance testing to catch regressions before they reach users.