-
-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-implement doc index trie with more basic data structures
- For each node's mapping from chars to sub-nodes: Use an association list instead of a hash-table. Nearly all satisfy the ~40 item rule of thumb for when to prefer alists. - For each node's values: Mutate a plain list instead of a mutable-set. (As before, each value is a promise, forced only upon search.) Together this makes it noticeably faster to build the trie -- on my machine, down from about 1.0 to 0.5 seconds. Also the initial memory use seems less, although that can be trickier to measure. The search times remain similar: Nearly too fast to measure. Although the resulting code isn't quite as concise or elegant, I think it's worthwhile.
- Loading branch information
1 parent
26c0531
commit 5259e37
Showing
1 changed file
with
53 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters