@wry/trie idea: speed up lookupArray by avoiding forEach and arrow function allocation
Open
@wry/trie
enhancement
- Dominant language
- TypeScript
- Stars
- 91
- Forks
- 15
- PR merge metrics
- No merged PRs in 30d
Description
In code that relies heavily on the `Trie` data structure provided by `@wry/trie`, [this code](https://github.com/benjamn/wryware/blob/27a83c25c8dd913daf8c6fd3f450ab6cc1ba0111/packages/trie/src/trie.ts#L29-L33) has the potential to be hot, and thus worth optimizing for speed, even if that means rewriting it in a different style:
```ts
public lookupArray(array: T): Data {
let node: Trie = this;
forEach.call(array, key => node = node.getChildTrie(key));
return node.data || (node.data = this.makeData(slice.call(array)));
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.