Skip to content

Commit

Permalink
add more implementations to list and extra info
Browse files Browse the repository at this point in the history
  • Loading branch information
elidoran committed Apr 23, 2017
1 parent 1e102ec commit 638a267
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,21 @@

Quickly flatten an array in-place.

View [many implementation variations](https://github.com/elidoran/array-flatten/tree/add-more/benchmark/code/flatten) and use it to run benchmarks. This implementation is named `inplace2.js` there.
Fastest implementation when compared to several published packages and many unpublished variations.

Run `npm run perf` to compare the performance of this implementation to both [array-flatten](https://www.npmjs.com/package/array-flatten) and [flatten-array](https://www.npmjs.com/package/flatten-array).
View [many implementation variations](https://github.com/elidoran/array-flatten/tree/add-more/benchmark/code/flatten) and use it to run benchmarks. This package's implementation is named `inplace2.js` there.

For this repo, run `npm run perf` to compare the performance of this implementation to:

1. [arr-flatten](https://www.npmjs.com/package/arr-flatten)
2. [array-flatten](https://www.npmjs.com/package/array-flatten)
3. [compute-flatten](https://www.npmjs.com/package/compute-flatten)
4. [flatten-array](https://www.npmjs.com/package/flatten-array)
5. [flatten](https://www.npmjs.com/package/flatten)
6. [just-flatten-it](https://www.npmjs.com/package/just-flatten-it)
7. [reduce-flatten](https://www.npmjs.com/package/reduce-flatten).

See screenshot of [performance results](#screenshot) below.


## Install
Expand Down Expand Up @@ -60,6 +72,9 @@ buildSomething([ // top-most array is a great target
])
```


### Screenshot

Performance results screenshot shows this implementation is significantly faster than the other two:

![Show performance comparison with various inputs for this implementation, array-flatten, and flatten-array.](docs/performance.png)
Expand Down

0 comments on commit 638a267

Please sign in to comment.