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

qcompare

v1.4.7

Published

the fastest function for comparing two js objects compatible with es6

Downloads

128

Readme

qcompare

the fastest function for comparing two js objects compatible with es6

Install

npm install --save qcompare

Usage

const qcompare = require( 'qcompare');

qcompare( { foo: 1 }, { foo: 1 } ); // true
qcompare( { bar: 1 }, { bar: 2 } ); // false

Features

  • support for all new classes ES6;
  • very quickly compares;
  • correctly compares:
    • for Promise, Symbol, WeakMap, WeakSet, function - compared by reference;
    • for Map and Set - takes into account the insertion order;
    • for Map supported NaN for keys;
    • for Date supported NaN for return value;
  • does not support circular objects;
  • object-keys for the Map are compared by reference;

Benchmarks

Nodejs - v16.8.0
Date - 07.12.2022

Synthetic test, iteration for a large object

qcompare - 5.663s
nano-equal - 8.679s
dequal - 8.265s
fast-deep-equal - 7.330s
fast-equals - 43.327ms
react-fast-compare - 7.969s
lodash.isequal - 43.291s

For more balanced testing of performance, tests of other projects were used

fast-deep-equal v3.1.3 project test result

qcompare x 328,360 ops/sec ±0.27% (92 runs sampled)
fast-deep-equal x 275,325 ops/sec ±0.54% (92 runs sampled)
fast-deep-equal/es6 x 229,257 ops/sec ±0.43% (97 runs sampled)
fast-equals x 257,231 ops/sec ±0.31% (94 runs sampled)
nano-equal x 173,235 ops/sec ±0.29% (96 runs sampled)
shallow-equal-fuzzy x 119,923 ops/sec ±0.45% (94 runs sampled)
underscore.isEqual x 79,648 ops/sec ±0.77% (93 runs sampled)
lodash.isEqual x 36,797 ops/sec ±0.65% (96 runs sampled)
deep-equal x 87.99 ops/sec ±4.44% (42 runs sampled)
deep-eql x 23,791 ops/sec ±0.78% (93 runs sampled)
ramda.equals x 10,551 ops/sec ±1.65% (95 runs sampled)
util.isDeepStrictEqual x 49,437 ops/sec ±0.58% (96 runs sampled)
assert.deepStrictEqual x 579 ops/sec ±0.40% (93 runs sampled)
The fastest is qcompare

fast-equals v4.0.3 project test result

| | Ops / sec | | ---------------------- | --------- | | qcompare | 5 492,983 | | fast-equals | 3 495,332 | | deep-eql | 1 880,796 | | fast-equals (circular) | 1 859,143 | | fast-deep-equal | 1 783,733 | | react-fast-compare | 1 556,482 | | nano-equal | 652,388 | | underscore.isEqual | 445,516 | | lodash.isEqual | 219,295 | | assert.deepStrictEqual | 10,583 | | deep-equal | 0,671 |

dequal v2.0.3 project test result

(basic) Benchmark:
  assert.deepStrictEqual x 242,497 ops/sec ±0.90% (92 runs sampled)
  util.isDeepStrictEqual x 243,227 ops/sec ±0.88% (95 runs sampled)
  fast-deep-equal        x 1,283,468 ops/sec ±0.44% (95 runs sampled)
  lodash.isEqual         x 265,328 ops/sec ±0.86% (94 runs sampled)
  nano-equal             x 969,216 ops/sec ±1.06% (95 runs sampled)
  dequal/lite            x 1,350,907 ops/sec ±2.40% (93 runs sampled)
  dequal                 x 1,360,938 ops/sec ±0.87% (94 runs sampled)
  qcompare               x 2,216,972 ops/sec ±0.70% (95 runs sampled)

(complex) Benchmark(excluding object-keys for the Map):
  assert.deepStrictEqual x 112,922 ops/sec ±0.95% (93 runs sampled)
  util.isDeepStrictEqual x 113,051 ops/sec ±1.08% (95 runs sampled)
  lodash.isEqual         x 52,685 ops/sec ±1.18% (89 runs sampled)
  dequal                 x 467,948 ops/sec ±0.51% (95 runs sampled)
  qcompare               x 1,158,099 ops/sec ±1.43% (92 runs sampled)

License

MIT Yuriy Khomenko