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

Binary Search on Coins #3012

Closed
4 tasks
alexanderbez opened this issue Dec 5, 2018 · 5 comments
Closed
4 tasks

Binary Search on Coins #3012

alexanderbez opened this issue Dec 5, 2018 · 5 comments
Labels
T: Performance Performance improvements Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity.

Comments

@alexanderbez
Copy link
Contributor

Ref: #2694 (comment)

Coins should have a generic method that binary searches for a given Coin, so things like AddCoinByDenom and SubCoinByDenom can work more efficiently.

/cc @cwgoes


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@alexanderbez alexanderbez added post-launch Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity. labels Dec 5, 2018
@rigelrozanski
Copy link
Contributor

lol let's wait until we have at least 4 denoms on the hub before implementing this one

@alexanderbez
Copy link
Contributor Author

Totally agree with you! Just creating the issue so we don't forget 😉

@cwgoes
Copy link
Contributor

cwgoes commented Dec 6, 2018

lol let's wait until we have at least 4 denoms on the hub before implementing this one

Hehe yeah. To be honest we probably would want to rearchitect the coins type completely to support thousands of denominations, unless most transaction load will be multi-asset transfers.

@odeke-em
Copy link
Collaborator

@elias-orijtech this could be low-hanging fruit that we can get out with a method: .Search which firstly presumes that the coins are sorted and then can invoke sort.Search or a binary search implementation if the comparators are more specialized.

@odeke-em
Copy link
Collaborator

odeke-em commented Dec 7, 2023

.Find was implemented in May 2022 in PR #11959 by Robert Zaremba. I am going to close this feature request as completed.

@odeke-em odeke-em closed this as completed Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: Performance Performance improvements Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity.
Projects
No open projects
Development

No branches or pull requests

5 participants