Skip to content

Commit 81df55e

Browse files
Add benchmarks to description
1 parent f02fdde commit 81df55e

File tree

3 files changed

+1489
-2
lines changed

3 files changed

+1489
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Other packages have stricter assumptions or are not as performant, as they often
1919
[o-unflatten](https://www.npmjs.com/package/o-unflatten) requires the input to be ordered such that parent nodes always come before their children.
2020
[un-flatten-tree](https://www.npmjs.com/package/un-flatten-tree) uses 2 nested loops (time complexity `O(n^2)`).
2121

22-
This implementation does not require any order of items in the input array and focuses on runtime performance. It uses an index and a single loop (time complexity `O(n)`). It was inspired by [this discussion](http://stackoverflow.com/questions/444296/how-to-efficiently-build-a-tree-from-a-flat-structure) on StackOverflow.
22+
This implementation does not require any order of items in the input array and focuses on runtime performance. It is the fastest amongst 4 different packages, you can find the benchmarks [here](https://github.com/philipstanislaus/array-to-tree-benchmarks). It uses an index and a single loop (time complexity `O(n)`). It was inspired by [this discussion](http://stackoverflow.com/questions/444296/how-to-efficiently-build-a-tree-from-a-flat-structure) on StackOverflow.
2323

2424
## Installation
2525

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.1.4",
44
"description": "Converts an array of items with ids and parent ids to a nested tree in a performant `O(n)` way. Runs in browsers and node.",
55
"keywords": [
6-
"array to tree", "list to tree", "array-helper", "array-manipulations", "data-structures", "datastructures", "algorithms", "tree-structure", "array", "list", "collection", "pointer", "parent", "children", "child", "tree", "navigation", "nested", "util", "traverse", "descendants", "ancestors"
6+
"array to tree", "list to tree", "unflatten", "array-helper", "array-manipulations", "data-structures", "datastructures", "algorithms", "tree-structure", "array", "list", "collection", "pointer", "parent", "children", "child", "tree", "navigation", "nested", "util", "traverse", "descendants", "ancestors"
77
],
88
"main": "build/arrayToTree.min.js",
99
"types": "build/arrayToTree.d.ts",

0 commit comments

Comments
 (0)