npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

turbo-combine-reducers

v1.0.2

Published

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

Downloads

88,969

Readme

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.