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] Add sortIfNeed() in sortedlist #3172

Merged
merged 2 commits into from
Mar 9, 2022
Merged

Conversation

Liuhaai
Copy link
Member

@Liuhaai Liuhaai commented Mar 8, 2022

Most trie operations are getState(), which load branchnode from hashnode and call Search(). Therefore, the trie performance improves by avoiding sorting work when loading branchnode

@Liuhaai Liuhaai requested a review from a team as a code owner March 8, 2022 22:43
@Liuhaai Liuhaai changed the title [trie] add sortIfNeed() in sortedlist [trie] Add sortIfNeed() in sortedlist Mar 8, 2022
@codecov
Copy link

codecov bot commented Mar 8, 2022

Codecov Report

Merging #3172 (3f795a8) into master (56801c5) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3172      +/-   ##
==========================================
- Coverage   75.13%   75.13%   -0.01%     
==========================================
  Files         221      221              
  Lines       21013    21021       +8     
==========================================
+ Hits        15789    15795       +6     
- Misses       4388     4389       +1     
- Partials      836      837       +1     
Impacted Files Coverage Δ
db/trie/mptrie/sortedlist.go 100.00% <100.00%> (ø)
db/trie/mptrie/extensionnode.go 91.22% <0.00%> (-1.76%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 56801c5...3f795a8. Read the comment docs.

Copy link
Collaborator

@CoderZhi CoderZhi left a comment

Choose a reason for hiding this comment

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

what if a new created sortedlist is iterated?

@Liuhaai
Copy link
Member Author

Liuhaai commented Mar 8, 2022

what if a new created sortedlist is iterated?

The internal list should be accessed via sl.List(), like for _, idx := range b.indices.List() {}

@Liuhaai Liuhaai merged commit 3a8f362 into iotexproject:master Mar 9, 2022
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