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 hashing #1659

Closed
wants to merge 10 commits into from

Conversation

hqjang-pepper
Copy link
Contributor

@hqjang-pepper hqjang-pepper commented Nov 2, 2022

Proposed changes

This is a follow-up PR of #1656, should be merged after #1656

Types of changes

Please put an x in the boxes related to your change.

  • Bugfix
  • New feature or enhancement
  • Others

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING GUIDELINES doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes ($ make test)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Related issues

  • Please leave the issue numbers or links related to this PR here.

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@hqjang-pepper
Copy link
Contributor Author

hqjang-pepper commented Nov 14, 2022

before & after applying #1659 + #1656

  • Hash
before
BenchmarkHashFixedSize
BenchmarkHashFixedSize/10
BenchmarkHashFixedSize/10-10 	           27930	     42784 ns/op	   14004 B/op	     157 allocs/op
BenchmarkHashFixedSize/100
BenchmarkHashFixedSize/100-10         	   10000	    100930 ns/op	   65665 B/op	     777 allocs/op
BenchmarkHashFixedSize/1K
BenchmarkHashFixedSize/1K-10          	    1232	    982107 ns/op	  657792 B/op	    7784 allocs/op
BenchmarkHashFixedSize/10K
BenchmarkHashFixedSize/10K-10         	     277	   4412435 ns/op	 6906100 B/op	   79662 allocs/op
BenchmarkHashFixedSize/100K
BenchmarkHashFixedSize/100K-10        	      30	  40766426 ns/op	68241484 B/op	  794507 allocs/op

after 
BenchmarkHashFixedSize
BenchmarkHashFixedSize/10
BenchmarkHashFixedSize/10-10 	           35845	     32955 ns/op	   12054 B/op	     149 allocs/op
BenchmarkHashFixedSize/100
BenchmarkHashFixedSize/100-10         	   10000	    101520 ns/op	   58953 B/op	     740 allocs/op
BenchmarkHashFixedSize/1K
BenchmarkHashFixedSize/1K-10          	    1267	    930975 ns/op	  598084 B/op	    7444 allocs/op
BenchmarkHashFixedSize/10K
BenchmarkHashFixedSize/10K-10         	     290	   4117625 ns/op	 6323543 B/op	   77091 allocs/op
BenchmarkHashFixedSize/100K
BenchmarkHashFixedSize/100K-10        	      27	  37786035 ns/op	62431504 B/op	  767766 allocs/op
  • Commit
Before
BenchmarkCommitAfterHashFixedSize
BenchmarkCommitAfterHashFixedSize/10
BenchmarkCommitAfterHashFixedSize/10-10 	           30988	     38790 ns/op	   36083 B/op	     208 allocs/op
BenchmarkCommitAfterHashFixedSize/100
BenchmarkCommitAfterHashFixedSize/100-10         	    8286	    145892 ns/op	  174370 B/op	    1022 allocs/op
BenchmarkCommitAfterHashFixedSize/1K
BenchmarkCommitAfterHashFixedSize/1K-10          	     828	   1485660 ns/op	 1701478 B/op	   10143 allocs/op
BenchmarkCommitAfterHashFixedSize/10K
BenchmarkCommitAfterHashFixedSize/10K-10         	      74	  14636495 ns/op	18696716 B/op	  103985 allocs/op
BenchmarkCommitAfterHashFixedSize/100K
BenchmarkCommitAfterHashFixedSize/100K-10        	       7	 148162095 ns/op	180172019 B/op	 1038887 allocs/op

After
BenchmarkCommitAfterHashFixedSize
BenchmarkCommitAfterHashFixedSize/10
BenchmarkCommitAfterHashFixedSize/10-10 	           60080	     20030 ns/op	   30914 B/op	     189 allocs/op
BenchmarkCommitAfterHashFixedSize/100
BenchmarkCommitAfterHashFixedSize/100-10         	   12500	     96729 ns/op	  151233 B/op	     918 allocs/op
BenchmarkCommitAfterHashFixedSize/1K
BenchmarkCommitAfterHashFixedSize/1K-10          	    1052	   1188825 ns/op	 1473359 B/op	    9108 allocs/op
BenchmarkCommitAfterHashFixedSize/10K
BenchmarkCommitAfterHashFixedSize/10K-10         	      94	  11857340 ns/op	16368251 B/op	   93862 allocs/op
BenchmarkCommitAfterHashFixedSize/100K
BenchmarkCommitAfterHashFixedSize/100K-10        	       9	 121488097 ns/op	157054739 B/op	  937567 allocs/op

collapsed.Children[i], cached.Children[i] = h.hash(child, false)
} else {
collapsed.Children[i] = nilValueNode
}
}
}
cached.Children[16] = n.Children[16]
Copy link
Contributor

Choose a reason for hiding this comment

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

In ethereum PR, this line is removed, but not here. Any reason for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cached.Children[16] = n.Children[16]
you mean this line?
Yeah you are right, ethereum changed this line but I didn't, because changing logic has nothing to do with Children[16], So I didn't change this part

@kjhman21 kjhman21 modified the milestones: v1.10 (Kore), v1.11 (Mantle) Nov 21, 2022
@aidan-kwon aidan-kwon marked this pull request as draft July 18, 2023 03:38
@aidan-kwon aidan-kwon removed this from the v1.11.0 milestone Jul 24, 2023
@blukat29
Copy link
Contributor

Replaced by #1840.

@blukat29 blukat29 closed this Sep 20, 2023
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.

None yet

5 participants