-
Notifications
You must be signed in to change notification settings - Fork 580
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
refactor: Directly swap two variables to optimize code #8719
Conversation
Signed-off-by: jingchanglu <jingchanglu@outlook.com>
WalkthroughThe pull request modifies the Changes
Sequence Diagram(s)sequenceDiagram
participant P as pairs
participant A as Swap Method
participant T as Temporary Variable (Old Implementation)
P->>A: Call Swap(i, j)
A->>T: Assign p[i] to temp
A->>A: Assign p[j] to p[i]
A->>T: Assign temp to p[j]
A-->>P: Return
sequenceDiagram
participant P as pairs
participant A as Swap Method (New Implementation)
P->>A: Call Swap(i, j)
A->>A: Assign p[i], p[j] = p[j], p[i]
A-->>P: Return
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Files skipped from review due to trivial changes (1)
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Hey, thanks for the PR, for optimisation PRs we would love to see some benchmark stats as well Lmk if you can benchmark 🙇 |
This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. Thank you! |
Closing for now, feel free to reopen with benchmarks |
Closes: #XXX
What is the purpose of the change
Directly swap two variables to optimize code
Testing and Verifying
(Please pick one of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Documentation and Release Note
Unreleased
section ofCHANGELOG.md
?Where is the change documented?
x/{module}/README.md
)