Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch insertion application #56

Open
carver opened this issue May 6, 2018 · 0 comments
Open

Batch insertion application #56

carver opened this issue May 6, 2018 · 0 comments

Comments

@carver
Copy link
Contributor

carver commented May 6, 2018

What was wrong?

When a trie adds a single value, it must fix up all the nodes it touched along the way. This carries some performance cost, but is necessary for any single update. When applying a batch update, all the intermediate node fixups are wasted work. We could gain some (likely) significant performance benefits from a smarter batch-apply of a bunch of key/value pairs.

How to fix it

Rough concept: walk through the trie with all scheduled insertions, applying them simultaneously.

For example, if two keys from the batch have the same first nibble, then follow the root node down into the extension/leaf/branch node with that nibble, keeping both of those insertions in memory. Then apply them both to the newly created node at the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant