-
Notifications
You must be signed in to change notification settings - Fork 124
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 the performance of BaseToQuoteQuantums
& BigRatMulPpm
#1546
Conversation
Warning Rate Limit Exceeded@BrendanChou has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 7 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. WalkthroughThe recent update includes enhancements to the testing suite of the protocol library. It introduces a new benchmark function in Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
BaseToQuoteQuantums
BaseToQuoteQuantums
& BigRatMulPpm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- protocol/lib/quantums_test.go (2 hunks)
Additional Context Used
Path-based Instructions (1)
protocol/lib/quantums_test.go (1)
Pattern
**/**
: Do not include a walkthrough. For all comments on line changes that are longer than 15 lines, add a prefix to the comment of what lines you are commenting on (for example: "The changes from lines 100 to 200...". Add your comment to be on the last 15 lines of the chunk rather than adding your comment to the entire chunk.
Additional comments not posted (1)
protocol/lib/quantums_test.go (1)
225-250
: LGTM! Ensure the expected result in the benchmark is accurate.
2910959
to
3feb0df
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Out of diff range and nitpick comments (1)
protocol/lib/big_math_test.go (1)
381-400
: The new test cases forTestBigRatMulPpm
effectively cover scenarios with common and no common divisors for both positive and negative inputs. The use ofrequire.Equal
ensures that the results are as expected.Consider adding comments within the test cases to briefly explain the rationale behind each specific scenario, especially for the cases with no common divisor, to aid future maintainability.
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- protocol/lib/big_math_test.go (1 hunks)
- protocol/lib/quantums_test.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- protocol/lib/quantums_test.go
Additional Context Used
Path-based Instructions (1)
protocol/lib/big_math_test.go (1)
Pattern
**/**
: Do not include a walkthrough. For all comments on line changes that are longer than 15 lines, add a prefix to the comment of what lines you are commenting on (for example: "The changes from lines 100 to 200...". Add your comment to be on the last 15 lines of the chunk rather than adding your comment to the entire chunk.
Additional comments not posted (1)
protocol/lib/big_math_test.go (1)
Line range hint
1-400
: The rest of the file remains unchanged and all existing tests are functioning as expected. No issues found.
@Mergifyio backport release/protocol/v5.x |
✅ Backports have been created
|
) * add benchmark for BaseToQuoteQuantums * improve functions (cherry picked from commit 3b5043e)
…ckport #1546) (#1672) Co-authored-by: Brendan Chou <[email protected]>
Changelist
BaseToQuoteQuantums
optimized by about 80% andBigRatMulPpm
optimized by about 20%multiplyByPrice
andFundingRateToIndex
can be removed like in Remove logic ofFundingRateToIndex
#1528, but am keeping this PR small for now to ensure it can be backported if neededTest Plan
BaseToQuoteQuantums
BaseToQuoteQuantums
including rounding for negative numbersBenchmark Results
Before:
After: