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

trie: parallel commit (alternative version) #30545

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

holiman
Copy link
Contributor

@holiman holiman commented Oct 3, 2024

Alternative to #30461

I've attempted to do it differently.

  • Get rid of the wrapped node struct
  • On top level, spin out new committers, one per goroutine. Each committer has it's own internal nodeset. After finishing it's work, each goroutine merges it's own nodeset with the parent nodeset.

With this approach, I get

BenchmarkCommit/commit-5000nodes-single-8                    129           9849412 ns/op         4620280 B/op      55223 allocs/op
BenchmarkCommit/commit-5000nodes-parallel-8                  313           3974443 ns/op         5592933 B/op      55789 allocs/op

So the 9ms -> 10ms for single-thread, and 4ms for multi-threaded approach. The mem usage is only marginally higher than current master.

@@ -133,21 +156,20 @@ func (c *committer) store(path []byte, n node) node {
// deleted only if the node was existent in database before.
_, ok := c.tracer.accessList[string(path)]
if ok {
c.nodes.AddNode(path, trienode.NewDeleted())
c.nodes.AddNode(path, trienode.NewDeleted()) // TODO
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm todo

@holiman
Copy link
Contributor Author

holiman commented Oct 3, 2024

Running this on 07 vs master on 08 now

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

Successfully merging this pull request may close these issues.

3 participants