https://github.com/halfzebra/array-search-benchmark
https://github.com/halfzebra/array-search-benchmark
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/halfzebra/array-search-benchmark
- Owner: halfzebra
- Created: 2016-12-13T11:05:37.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-28T13:51:01.000Z (over 9 years ago)
- Last Synced: 2025-03-13T14:29:00.912Z (over 1 year ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Array Search Benchmark
This benchmark is focused on determining the fastest way to find if object is in the array by the property or by the reference.
```bash
$ node -v
v6.5.0
$ node test
By property
Array#some es5 x 9,225 ops/sec ±1.36% (87 runs sampled)
Array#some es6 arrow deconstruction x 8,860 ops/sec ±1.49% (87 runs sampled)
Array#find es5 x 10,587 ops/sec ±1.40% (85 runs sampled)
Array#find es6 arrow deconstruction x 9,782 ops/sec ±1.90% (86 runs sampled)
Array#filter es5 x 6,890 ops/sec ±1.29% (85 runs sampled)
Array#filter es6 arrow deconstruction x 6,580 ops/sec ±2.55% (84 runs sampled)
Fastest is Array#find es5
Slowest is Array#filter es6 arrow deconstruction
By reference
Array#includes es7 x 10,630 ops/sec ±1.39% (85 runs sampled)
Array#indexOf es5 x 267,177 ops/sec ±1.30% (85 runs sampled)
Fastest is Array#indexOf es5
Slowest is Array#includes es7
```