Skip to content

Conversation

@notJoon
Copy link
Member

@notJoon notJoon commented Nov 26, 2025

Description

This PR optimizes the liquidity_amounts.gno file by removing unnecessary Clone operations and redundant toAscendingOrder calls. This will improved performance and reduced memory allocations without compromising safety or functionality.

Note: Depends on #1004

Changes

  • Removed unnecessary Clone operations
    • The u256.Uint arithmetic operations (MulDiv, Sub, Add, Lsh, Div) are non-mutation, so they return new instances without modifying their receivers or input parameters.
    • The functions only read from input values, never modofying them
  • Eliminated redundant toAscendingOrder calls
    • Both public functions and internal helper functions were calling toAscendingOrder
    • This resulted in the same values being sorted multiple times in a single execution path

@notJoon notJoon self-assigned this Nov 26, 2025
@notJoon notJoon marked this pull request as ready for review November 26, 2025 07:35
@notJoon notJoon changed the title fix(common): Remove unnecessary cloning and reduce function calls fix(common): Remove unnecessary Clone calls and redundant ordering Nov 26, 2025
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 1, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants