axieinfinity / ronin

A DPoS blockchain.
GNU Lesser General Public License v3.0
67 stars 30 forks source link

trie: parallel insert trie when root node is a full node #597

Open minh-bq opened 2 weeks ago

minh-bq commented 2 weeks ago

This creates a new TryBatchInsert function in trie. All key-value insertion pairs are passed together. If the resolved root node is a full node, the insertion pairs are partitioned by the first byte in their keys. Children subtries of the full node are inserted in parallel. If the resolved root node is not a full node, the insertion pairs are inserted sequentially.

goos: linux goarch: amd64 pkg: github.com/ethereum/go-ethereum/core cpu: Intel(R) Xeon(R) CPU @ 2.30GHz

Before this PR BenchmarkManyStorageUpdate-4 5 1444317082 ns/op

After this PR BenchmarkManyStorageUpdate-4 5 792899625 ns/op