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

Improve TrieStore Dictionary use and Hashing #6979

Merged
merged 2 commits into from
May 4, 2024
Merged

Conversation

benaadams
Copy link
Member

@benaadams benaadams commented May 4, 2024

Changes

  • seal Hash256
  • Introduce ValueHash256.GetChainedHashCode(uint previousHash); if previous hash is randomised seeded can just use that as input for next hash, rather than starting with randomised seed and then combining at end (saving 2 hash combines)
  • TreePath.Equals check Length first rather than last as simpler compare
  • AddOrUpdate on ConcurrentDictionary rather than Contains + set
  • ref CollectionsMarshal.GetValueRefOrAddDefault on Dictionary rather than ContainsKey + set
  • Reduce some struct copying

Types of changes

What types of changes does your code introduce?

  • Optimization

Testing

Requires testing

  • No

@benaadams benaadams requested review from asdacap and LukaszRozmej May 4, 2024 10:54
@benaadams benaadams merged commit 50df67d into master May 4, 2024
67 checks passed
@benaadams benaadams deleted the triestore-hashing branch May 4, 2024 11:46
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