Socket
Book a DemoInstallSign in
Socket

fast-is-equal

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-is-equal

Blazing-fast equality checks, minus the baggage. A lean, standalone alternative to Lodash's isEqual—because speed matters.

1.2.3
latest
Source
npmnpm
Version published
Weekly downloads
305
-14.08%
Maintainers
1
Weekly downloads
 
Created
Source

fast-is-equal

⚡️Blazing-fast equality checks, minus the baggage. A lean, standalone alternative to Lodash's isEqual - because speed matters.

npm version License npm bundle size Workflow Status React Compatibility React Native Compatibility Angular Compatibility Vue Compatibility Svelte Compatibility Modern JS Frameworks

Why fast-is-equal?

  • 🚀 Lightning Speed: Up to 55.84x faster than Lodash's isEqual (average 11.73x faster across 49 test cases).
  • 🪶 Lightweight: Dependency-free, minimal footprint.
  • 🔄 Versatile: Handles primitives, objects, arrays, Maps, Sets, typed arrays, circular references, and more.
  • 🏆 Proven: Outperforms Lodash in 93.9% of benchmark cases.

Installation

Using yarn:

yarn add fast-is-equal

Using npm:

npm install fast-is-equal

Usage

import { fastIsEqual } from 'fast-is-equal';

console.log(fastIsEqual(1, 1)); // true
console.log(fastIsEqual({ a: 1 }, { a: 1 })); // true
console.log(fastIsEqual([1, 2], [1, 3])); // false

Performance Benchmarks

fast-is-equal was tested against Lodash's isEqual across 49 diverse test cases with 1,000,000 iterations each. The results speak for themselves:

Key Highlights

  • Average Speed: fastIsEqual is 11.73x faster (0.000172 ms vs. 0.002013 ms).
  • Win Rate: Outperforms Lodash in 46/49 cases (93.9%).
  • Peak Performance: Up to 55.84x faster for large Sets.

Top 10 Performance Gains

Test CasefastIsEqual (ms)Lodash isEqual (ms)Speed Boost
Large Set (100 items)0.0006730.03756455.84x 🚀
Map vs Set0.0000180.00048526.52x 🚀
Large Map (50 entries)0.0010590.02575624.32x 🚀
Map with primitives0.0000920.00148716.09x 🚀
Map (unequal)0.0000920.00140615.29x 🚀
Large TypedArray (1000)0.0009440.01316513.95x 🚀
ArrayBuffer (small)0.0000920.00126313.74x 🚀
Empty Set0.0000580.00069111.96x 🚀
Empty Map0.0000580.00068411.84x 🚀
Set of strings0.0000820.00094011.51x 🚀

Performance Across Categories

  • Primitives: Competitive performance with smart optimizations for edge cases like NaN
  • Objects: 1.59x–2.87x faster, with best gains on simple and nested structures
  • Arrays: 1.24x–4.38x faster, excelling at primitive arrays and sparse arrays
  • TypedArrays: 11.30x–13.95x faster, dramatically outperforming on all variants
  • Special Objects: 8.63x–10.25x faster for Dates and RegExp
  • Collections: 10.84x–55.84x faster for Maps and Sets, with exceptional gains on large collections
  • Circular References: 3.04x–3.72x faster with optimized cycle detection

Detailed Benchmark Results

Run yarn benchmark or npm run benchmark to test locally. Full results available in benchmarks/results.txt.

Edge Cases Where Lodash Wins

Only 3 cases where Lodash marginally outperforms (by less than 5%):

  • String vs Number: 0.95x slower
  • Large Numbers: 0.99x slower
  • Boolean vs Number: 0.99x slower

These represent cross-type comparisons with negligible real-world impact.

Features

  • Dependency-Free: No bloat, just performance.
  • Comprehensive: Supports all JavaScript types, including edge cases like circular references and typed arrays.
  • Optimized: Fine-tuned for real-world use cases (e.g., API responses, state objects).

License

MIT

🙏 Support the project

LiberPay_Donation_Button           Paypal_Donation_Button           Paypal_Donation_Button

Keywords

deep-equal

FAQs

Package last updated on 31 May 2025

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.