insanicly/blinkreact

A simple performance analysis tool for React components

โ˜… 0Forks 0GitHub โ†—Compare

README

๐Ÿš€ BlinkReact

BlinkReact Logo

BlinkReact Logo

npm version License: ISC npm downloads

A powerful performance analysis tool for React components that detects unnecessary re-renders, measures render times, and provides optimization suggestions.


โœจ Features

  • ๐Ÿ”„ Render Count Tracking: Monitor how many times a component re-renders and detect unnecessary re-renders
  • โฑ๏ธ Render Time Measurement: Measure the time taken for initial and subsequent renders
  • ๐Ÿง  State Update Monitoring: Track state changes and detect redundant updates
  • ๐Ÿ› ๏ธ Performance Recommendations: Get actionable suggestions for optimizing your component

๐Ÿ“ฆ Installation

# Install globally
npm install -g blinkreact

# Or use npx without installing
npx blinkreact <component-file>

๐Ÿšฆ Usage

blinkreact path/to/your/component.tsx

๐Ÿ” How It Works

BlinkReact analyzes your React component through a 4-step process:

  1. ๐Ÿงช Instrumentation: Adds performance tracking code to your component
  2. ๐Ÿ“Š Render Analysis: Measures render counts and durations
  3. ๐Ÿ”„ State Analysis: Detects redundant state updates and inefficient patterns
  4. ๐Ÿ“ Report Generation: Creates a comprehensive performance report

๐Ÿ“„ Output

BlinkReact generates a detailed PERFORMANCE_REPORT.md file containing:

Section Description
๐Ÿ“Œ Component Info Component name and file path
โฑ๏ธ Render Metrics Total renders, render times, unnecessary renders
๐Ÿง  State Management State updates and redundancy analysis
๐Ÿ’ก Recommendations Actionable optimization suggestions

๐Ÿ”ง Requirements

  • Node.js >= 14.0
  • React >= 18.0

๐Ÿ“Š Example Report

Click to expand example report
# BlinkReact Performance Report

## Component: `TodoList`

**File Path:** `src/components/TodoList.tsx`  
**Analysis Date:** 2023-05-15 10:30:45

## Render Performance

- **Total Renders:** 5
- **Average Render Time:** 3.45ms
- **Maximum Render Time:** 8.12ms
- **Unnecessary Renders:** 2

## State Management

- **Total State Updates:** 10
- **Redundant State Updates:** 2

## Performance Recommendations

- **Reduce Unnecessary Renders:** Consider using `React.memo()` to prevent re-renders when props haven't changed.
- **Optimize Render Performance:** The component has slow renders. Consider breaking it down into smaller components.
- **Reduce Redundant State Updates:** The component has redundant state updates. Consider using functional updates.

๐Ÿค Contributing

Contributions, issues and feature requests are welcome! Feel free to check the issues page.

๐Ÿ“ License

This project is ISC licensed.


Built with โค๏ธ for the React community

Contributors

halitiince

Issues