Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

turbo-combine-reducers

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

turbo-combine-reducers

Speed-optimized drop-in replacement for Redux's combineReducers

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
24K
increased by2.4%
Maintainers
1
Weekly downloads
 
Created
Source

Turbo Combine Reducers

Build Status

Drop-in replacement for Redux's combineReducers, optimized for speed and bundle size.

Applying a technique of partial evaluation by pre-compiling a reducer updater function, it achieves upwards of 82x improved performance for an assumed typical real-world scenario (unchanging state for a medium-size object). See Benchmarks for specific performance metrics.

Turbo Combine Reducers has no dependencies, and weighs in at 260 bytes minified and gzipped.

Installation

Using npm as a package manager:

npm install turbo-combine-reducers

Otherwise, download a pre-built copy from unpkg:

https://unpkg.com/turbo-combine-reducers/dist/turbo-combine-reducers.min.js

Usage

As an imported package, the default export is the combineReducers function. If using the browser-ready distributable from unpkg, the same function is available at the window.turboCombineReducers global.

import combineReducers from 'turbo-combine-reducers';
// Or:
// var combineReducers = window.turboCombineReducers;

const reducer = combineReducers( {
	count( state = 0, action ) {
		// ...
	},
} );

As it is intended to serve as a drop-in replacement, refer to the documentation of Redux's combineReducers for usage instructions.

Benchmarks

The following benchmarks are performed in Node 10.12.0 on a MacBook Pro (Late 2016), 2.9 GHz Intel Core i7.

turbo-combine-reducers - unchanging (4 properties) x 120,638,598 ops/sec ±0.37% (87 runs sampled)
turbo-combine-reducers - unchanging (20 properties) x 23,740,676 ops/sec ±1.20% (90 runs sampled)
turbo-combine-reducers - changing (4 properties) x 40,028,499 ops/sec ±0.82% (90 runs sampled)
turbo-combine-reducers - changing (20 properties) x 23,338,161 ops/sec ±0.86% (88 runs sampled)
redux - unchanging (4 properties) x 1,480,178 ops/sec ±0.42% (93 runs sampled)
redux - unchanging (20 properties) x 594,068 ops/sec ±0.39% (90 runs sampled)
redux - changing (4 properties) x 1,390,904 ops/sec ±0.28% (92 runs sampled)
redux - changing (20 properties) x 589,844 ops/sec ±0.47% (92 runs sampled)

License

Copyright 2018 Andrew Duthie

Released under the MIT License.

Keywords

FAQs

Package last updated on 21 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc