Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
turbo-combine-reducers
Advanced tools
Speed-optimized drop-in replacement for Redux's combineReducers
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.
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
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.
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)
Copyright 2018 Andrew Duthie
Released under the MIT License.
1.0.2 (2018-10-20)
Bug Fixes
JSON.stringify
quoting behavior, avoiding remaining potential for runtime errors.FAQs
Speed-optimized drop-in replacement for Redux's combineReducers
The npm package turbo-combine-reducers receives a total of 17,436 weekly downloads. As such, turbo-combine-reducers popularity was classified as popular.
We found that turbo-combine-reducers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.