This repository was archived by the owner on Jan 20, 2026. It is now read-only.
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #573 +/- ##
==========================================
- Coverage 54.57% 54.57% -0.01%
==========================================
Files 632 632
Lines 55267 55272 +5
==========================================
- Hits 30164 30162 -2
- Misses 22946 22951 +5
- Partials 2157 2159 +2
🚀 New features to boost your workflow:
|
philipsu522
approved these changes
Mar 31, 2025
codchen
added a commit
that referenced
this pull request
Apr 26, 2025
## Describe your changes and provide context Previously `GetAllBalances` would perform slice copy operation for each iterator `Next` call due to how `Coin::Add` is implemented. The reason for the copy is because `Coin:Add` needs to sort the resulting slice. However this is unnecessary because at the end of `GetAllBalances` the slice would sorted again anyway. This PR changes the iterator operation to be a simple append, so that the total time complexity would be O(n) instead of O(n^2) ## Testing performed to validate your change unit test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes and provide context
Previously
GetAllBalanceswould perform slice copy operation for each iteratorNextcall due to howCoin::Addis implemented. The reason for the copy is becauseCoin:Addneeds to sort the resulting slice. However this is unnecessary because at the end ofGetAllBalancesthe slice would sorted again anyway. This PR changes the iterator operation to be a simple append, so that the total time complexity would be O(n) instead of O(n^2)Testing performed to validate your change
unit test