Gathering detailed insights and metrics for @luchanso/react-fast-compare
Gathering detailed insights and metrics for @luchanso/react-fast-compare
npm install @luchanso/react-fast-compare
Typescript
Module System
Node Version
NPM Version
67.8
Supply Chain
99.2
Quality
75.1
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
818
Last Day
1
Last Week
4
Last Month
21
Last Year
96
1 Stars
52 Commits
3 Watching
3 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
3.0.1
Package Id
@luchanso/react-fast-compare@3.0.1
Unpacked Size
11.75 kB
Size
4.71 kB
File Count
5
NPM Version
6.4.0
Node Version
10.9.0
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
-20%
4
Compared to previous week
Last month
200%
21
Compared to previous month
Last year
-22%
96
Compared to previous year
27
The fastest deep equal comparison for React. Really fast general-purpose deep comparison.
Great forshouldComponentUpdate
. This is a fork of the brilliant
fast-deep-equal with some
extra handling for React.
(Check out the benchmarking details.)
1$ yarn add @luchanso/react-fast-compare 2# or 3$ npm install @luchanso/react-fast-compare
1const isEqual = require("@luchanso/react-fast-compare"); 2 3// general usage 4console.log(isEqual({ foo: "bar" }, { foo: "bar" })); // true 5 6// react usage 7class ExpensiveRenderer extends React.Component { 8 shouldComponentUpdate(nextProps) { 9 return !isEqual(this.props, nextProps); 10 } 11 render() { 12 // ... 13 } 14}
Or like Hight ordered component
1const performance = require("@luchanso/react-fast-compare").performance; 2 3class ExpensiveRenderer extends React.Component { 4 render() { 5 // ... 6 } 7} 8 9export default performance()(ExpensiveRenderer);
shouldComponentUpdate
?What's faster than a really fast deep comparison? No deep comparison at all.
—This Readme
Deep checks in React's shouldComponentUpdate
should not be used blindly.
First, see if a
PureComponent
would work for you. If it won't (if you need deep checks), it's wise to make
sure you've correctly indentified the bottleneck in your application by
profiling the performance.
After you've determined that you do need deep equality checks and you've
identified the minimum number of places to apply them, then this library may
be for you! For more information about making your app faster, check out the
Optimizing Performance
section of the React docs.
All tests carried out locally on a MacBook. The absolute values are much less important than the relative differences between packages.
Benchmarking source can be found here. Each "operation" consists of running all relevant tests. The React benchmark uses both the generic tests and the react tests; these runs will be slower simply because there are more tests in each operation.
react-fast-compare x 207,503 ops/sec ±0.54% (92 runs sampled)
fast-deep-equal x 195,006 ops/sec ±0.70% (91 runs sampled)
lodash.isEqual x 43,778 ops/sec ±0.55% (91 runs sampled)
nano-equal x 198,036 ops/sec ±0.37% (95 runs sampled)
shallow-equal-fuzzy x 173,023 ops/sec ±0.59% (95 runs sampled)
fastest: react-fast-compare
react-fast-compare
and fast-deep-equal
should be the same speed for these
tests; any difference is just noise. react-fast-compare
won't be faster than
fast-deep-equal
, because it's based on it.
react-fast-compare x 187,628 ops/sec ±0.58% (93 runs sampled)
fast-deep-equal x 477 ops/sec ±0.55% (91 runs sampled)
lodash.isEqual x 35,100 ops/sec ±0.16% (95 runs sampled)
nano-equal x 468 ops/sec ±0.53% (94 runs sampled)
shallow-equal-fuzzy x 684 ops/sec ±0.43% (92 runs sampled)
fastest: react-fast-compare
Three of these packages cannot handle comparing React elements (which are
circular): fast-deep-equal
, nano-equal
, and shallow-equal-fuzzy
.
1$ yarn install 2$ yarn run benchmark
react-fast-compare@3.0.0 tracks fast-deep-equal@2.0.1
Please see our contributions guide.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
142 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More