Skip to content

Compare Redux Toolkit and Preact Signals in a high-performance UI stress test. Benchmark component re-renders vs DOM-level updates with 1000+ live widgets.

License

Notifications You must be signed in to change notification settings

ChiragChrg/Signals-vs-Redux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

42 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Signals vs Redux Performance Benchmark

A comprehensive React application demonstrating the performance differences between Preact Signals and Redux state management solutions through interactive benchmarks and real-time visualizations.

๐ŸŽฏ Overview

This project provides side-by-side performance comparisons between Signals and Redux, showcasing how different state management approaches affect React application performance, re-render counts, and user experience.

๐Ÿ”— Live Demo: signals-vs-redux.netlify.app

๐Ÿš€ Features

๐Ÿ“Š Performance Benchmarks

  • Basic Comparison: Single Signal vs Redux slice across multiple widgets
  • Multi-State Stress Test: Hundreds of independent state slices running simultaneously
  • Mixed Environment: Performance impact when both solutions coexist
  • Interactive Mutation: Real-time widget manipulation with live performance metrics

๐Ÿ”ง Interactive Controls

  • Dynamic Widget Count: Scale from 1 to 1000+ widgets
  • Adjustable Intervals: From 16ms (60fps) to custom update rates
  • Live Value Editing: Modify individual widget values during runtime
  • Performance Monitoring: Real-time FPS and render count tracking

๐ŸŽจ Visual Feedback

  • Re-render Highlighting: Visual indicators for component updates
  • Status Indicators: Real-time sync status for each widget
  • Animated Progress: Dynamic widgets showing state changes
  • Performance Metrics: Built-in timing measurements

๐Ÿ—๏ธ Architecture

๐Ÿ“ Project Structure

src/
โ”œโ”€โ”€ pages/                     # Demo routes
โ”‚   โ”œโ”€โ”€ signal/               # Pure Signals demo
โ”‚   โ”œโ”€โ”€ redux/                # Pure Redux demo  
โ”‚   โ”œโ”€โ”€ multi-signal/         # Multiple Signal widgets
โ”‚   โ”œโ”€โ”€ multi-redux/          # Multiple Redux slices
โ”‚   โ”œโ”€โ”€ signal-redux/         # Mixed environment test
โ”‚   โ””โ”€โ”€ incoming-signal/      # Interactive mutation demo
โ”œโ”€โ”€ store/
โ”‚   โ”œโ”€โ”€ signal/               # Signal state management
โ”‚   โ”œโ”€โ”€ redux/                # Redux state management  
โ”‚   โ””โ”€โ”€ combinedState.ts      # Mixed state orchestration
โ””โ”€โ”€ providers/
    โ””โ”€โ”€ ReduxProvider.tsx     # Redux provider wrapper

๐Ÿ› ๏ธ Tech Stack

  • Frontend: React 19, TypeScript, Tailwind CSS
  • State Management:
    • @preact/signals-react - Zero-render signals
    • @reduxjs/toolkit - Modern Redux with RTK
  • Build: Vite, ESLint
  • Routing: React Router DOM

๐ŸŽฎ Demo Routes

Route Description
/signal Pure Signals demo with multiple widgets
/redux Pure Redux demo showing re-render overhead
/multi-signal Hundreds of independent Signal widgets
/multi-redux Hundreds of Redux slices (performance stress test)
/signal-redux Mixed environment showing Redux impact on Signals
/incoming-signal Interactive real-time widget value mutation

๐Ÿšฆ Getting Started

Prerequisites

  • Node.js 18+ or Bun runtime
  • Modern browser with React DevTools

Installation

# Clone and install
git clone https://github.com/ChiragChrg/Signals-vs-Redux.git
cd Signals-vs-Redux
npm install  # or bun install

# Start development
npm run dev  # or bun dev

๐Ÿ”ง Recommended Browser Extensions

  1. React Developer Tools - Enable "Highlight updates when components render"
  2. FPS Monitor - Track real-time rendering performance

๐Ÿ“ˆ Performance Results

โšก Signals Advantages

  • Zero Re-renders: Direct DOM updates bypass React reconciliation
  • Granular Updates: Only affected elements update, not component trees
  • Consistent 60fps: Performance remains stable regardless of scale
  • Memory Efficient: Minimal overhead for state subscriptions

๐ŸŒ Redux Limitations

  • Component Re-renders: useSelector() triggers full component updates
  • Performance Degradation: Exponential slowdown with scale
  • Memory Overhead: Extensive component tree reconciliation
  • Cascade Effects: Single state change triggers hundreds of re-renders

๐Ÿ“Š Benchmark Data

Widget Count Redux FPS Signals FPS Performance Gain
100 ~45fps 60fps +33%
300 ~25fps 60fps +140%
500 ~15fps 60fps +300%
1000+ <10fps 60fps +500%+

๐ŸŽฏ Key Implementation Examples

Signals (Zero Re-renders)

// Direct DOM manipulation - no React re-renders
effect(() => {
    const value = widget?.metric.value || 0;
    if (barRef.current) {
        barRef.current.style.width = `${value}%`;
    }
});

Redux (Component Re-renders)

// Traditional pattern - triggers full component re-render
const widget = useSelector((state: RootState) => state[id]);

๐Ÿ› ๏ธ Build Commands

npm run build     # Production build
npm run preview   # Preview build locally
npm run lint      # Code linting

๐Ÿค Contributing

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/new-feature
  3. Commit changes: git commit -m 'Add new feature'
  4. Push and create Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License.
You are free to use, modify, and share this project, as long as you include the original copyright.

ยฉ 2025 ChiragChrg โ€” All rights reserved under MIT.

๐Ÿ”— Resources

About

Compare Redux Toolkit and Preact Signals in a high-performance UI stress test. Benchmark component re-renders vs DOM-level updates with 1000+ live widgets.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published