Skip to content

trie: make hasher benchmark meaningful post-caches#15288

Merged
karalabe merged 1 commit into
ethereum:masterfrom
karalabe:trie-hash-benchmark
Oct 13, 2017
Merged

trie: make hasher benchmark meaningful post-caches#15288
karalabe merged 1 commit into
ethereum:masterfrom
karalabe:trie-hash-benchmark

Conversation

@karalabe
Copy link
Copy Markdown
Member

@karalabe karalabe commented Oct 13, 2017

This PR is an aid for #15131

The trie hasher benchmark had two significant flaws that made it non-significant:

  • The data inserted into it didn't look like a realistic Ethereum trie. Trie keys in Ethereum are always hashes or addresses (either way random data), which makes the trie more or less balanced. The existing benchmark just inserts 20K incremental ints, making the tree unbalanced and inappropriate for concurrency benchmarks.
  • The trie has an internal cache, which among other, caches the result of hashing operations too. As such, the cost of hashing the trie N times will always be the cost of the first hash, since subsequent ops are NOOP.

This PR makes a few modifications to make the benchmark nicer:

  • Creates a realistc random account trie.
  • Uses the benchmark iteration count for the number of entries.
  • Reports memory allocs too for later concurrency testing.

@karalabe karalabe added this to the 1.7.2 milestone Oct 13, 2017
@karalabe karalabe requested a review from fjl October 13, 2017 08:15
@karalabe karalabe merged commit 41b7745 into ethereum:master Oct 13, 2017
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.

2 participants