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

perf!: reduce cloning, add inline attribute #78

Merged
merged 3 commits into from
Sep 3, 2024
Merged

perf!: reduce cloning, add inline attribute #78

merged 3 commits into from
Sep 3, 2024

Conversation

shuhuiluo
Copy link
Collaborator

No description provided.

Revise the `Fraction` and `CurrencyAmount` methods to reduce unnecessary cloning and improve performance. Add trait constraints and modify functions to work with references, enhancing code efficiency and maintainability.
Updated methods to return references instead of owned values and removed redundant clone operations. This should reduce unnecessary heap allocations and improve performance by minimizing malloc overhead.
Annotated various functions and methods with #[inline] to suggest the compiler perform inline expansion, potentially enhancing performance for frequently called operations. This change spans across multiple modules, including token, weth9, base_currency, currency_amount, percent, fraction, price, compute_price_impact, and ether.
@shuhuiluo shuhuiluo requested a review from malik672 September 3, 2024 05:02
@malik672 malik672 merged commit 15f1d3d into master Sep 3, 2024
2 checks passed
@shuhuiluo shuhuiluo deleted the perf branch September 3, 2024 07:02
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.

2 participants